Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 39130 invoked from network); 5 Sep 2008 18:02:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Sep 2008 18:02:24 -0000 Received: (qmail 15609 invoked by uid 500); 5 Sep 2008 18:02:16 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 15590 invoked by uid 500); 5 Sep 2008 18:02:16 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 15579 invoked by uid 99); 5 Sep 2008 18:02:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 11:02:16 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeffgbutler@gmail.com designates 64.233.182.187 as permitted sender) Received: from [64.233.182.187] (HELO nf-out-0910.google.com) (64.233.182.187) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 18:01:14 +0000 Received: by nf-out-0910.google.com with SMTP id 30so151230nfu.46 for ; Fri, 05 Sep 2008 11:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=lfBH4YGN9xUp+WF200+706R5SxYMi33chLNMQebLhzQ=; b=Sfa8QAzVzTzQHT/kiIusI2dHbHcbL63/ciQ33OViqZuAbg2ePoUd+lI8I3XN3RaJY1 SrnHW4ZV6iriH1K5X+uom73UZ3l6+2ie09YeomBjU0MoQbeesdmAbCav+tfzmJIk2sK5 CErgPJBd3PeXtqfrQc3QrI7+L+AnAOSyicup8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=x5b79RrHIY4Vgf1+IIEmO7C9lFANMljuw9jQAFRs1YsW2E07dz91YYekrSkSa85VaB Yqx9guAfX+7kerHjgioivvxmzr9U4a2/rClczVZVx/VP8CYkaa2NlFXCCgg8oqfOxEXK FgolexhbSr/HaD55R733aNKB53pmegYMHEN00= Received: by 10.210.25.19 with SMTP id 19mr2657771eby.131.1220637704835; Fri, 05 Sep 2008 11:01:44 -0700 (PDT) Received: by 10.210.28.9 with HTTP; Fri, 5 Sep 2008 11:01:44 -0700 (PDT) Message-ID: Date: Fri, 5 Sep 2008 13:01:44 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: Calendars in paramter Maps not working In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_65145_20581400.1220637704731" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_65145_20581400.1220637704731 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Specify your Calendar type handler directly like this: 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 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 resultMap=3D"AccountEventResult"> > SELECT * FROM user_event WHERE create_datetime > #fromDate:DATE# AND user_id=3D#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=3D"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=97at home, work, or on t= he > go. See Now > ------=_Part_65145_20581400.1220637704731 Content-Type: text/html; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Specify your Calendar type handler directly like this= :
 
<select id=3D"findByAccount" parameterClass=3D"map&q= uot; resultMap=3D"AccountEventResult">
  SELECT *= FROM user_event WHERE create_datetime <![CDATA[ < ]]> #fromDate,h= andler=3Dcom.foo.CalendarTypeHandler# AND user_id=3D#id#
</select>
Things get a little funky when there's a Map involved - iBATIS mus= t not be finding the type handler mapping.
 
Jeff Butler

On Fri, Sep 5, 2008 at 12:43 PM, I L <isster@hotmail.com&g= t; 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 wor= k!

I am having one issue with maps and cal= endars. 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 th= e other is a Calendar:

String id =3D> "3333"
Calendar fromDate =3D> Java Ca= lendar

The problem is that ibatis is throwing this error:
-------= ---------------------------
--- The error occurred in com/blahblah/confi= g/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=3D"findBy= Account" parameterClass=3D"map" resultMap=3D"AccountEve= ntResult">
            SELECT *= FROM user_event WHERE create_datetime <![CDATA[ < ]]> #fromDate:D= ATE# AND user_id=3D#id#
     </select>

= ----------------------------------

Now, if I pass a Date object inst= ead of a Calendar in the map, it works with no issues. We do have a Calenda= rTypeHandler and if I pass a Calendar as a single field (parameterClass=3D&= quot;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=97at home, work, or on the= go. See Now

------=_Part_65145_20581400.1220637704731--