ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From I L <iss...@hotmail.com>
Subject Calendars in paramter Maps not working
Date Fri, 05 Sep 2008 17:43:58 GMT
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

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#


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?

See how Windows Mobile brings your life together—at home, work, or on the go.
View raw message