Specify your Calendar type handler directly like this: <select id="findByAccount" parameterClass="map" resultMap="AccountEventResult"> SELECT * FROM user_event WHERE create_datetime <![CDATA[ < ]]> #fromDate,handler=com.foo.CalendarTypeHandler# AND user_id=#id# </select> Things get a little funky when there's a Map involved - iBATIS must not be finding the type handler mapping.
Jeff Butler On Fri, Sep 5, 2008 at 12:43 PM, I L <[EMAIL PROTECTED]> wrote: > Hi guys, > > Let me just start by saying this is an awesome project! We were using > hibernate which ended up being too complicated for what we needed. We > switched to ibatis and it fit like a glove. Keep up the good work! > > I am having one issue with maps and calendars. I am passing a Java Map as a > parameter to the <select> entity. It is a map of objects and has two > key-value pair. One is a String and the other is a Calendar: > > String id => "3333" > Calendar fromDate => Java Calendar > > The problem is that ibatis is throwing this error: > ---------------------------------- > --- The error occurred in com/blahblah/config/AccountEvent.xml. > --- The error occurred while applying a parameter map. > --- Check the AccountEvent.findByAccount-InlineParameterMap. > --- Check the parameter mapping for the 'fromDate' property. > --- Cause: java.lang.NullPointerException > [Ljava.lang.StackTraceElement;@b036af > ---------------------------------- > > Here is the xml: > <select id="findByAccount" parameterClass="map" > resultMap="AccountEventResult"> > SELECT * FROM user_event WHERE create_datetime <![CDATA[ < ]]> > #fromDate:DATE# AND user_id=#id# > </select> > > ---------------------------------- > > Now, if I pass a Date object instead of a Calendar in the map, it works > with no issues. We do have a CalendarTypeHandler and if I pass a Calendar as > a single field (parameterClass="java.util.Calendar") it works. For some > reason passing a Calendar in a parameter Map just doesn't work. > > Any hints? > > <http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008> > ------------------------------ > See how Windows Mobile brings your life together—at home, work, or on the > go. See Now <http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/> >
