ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: queryForMap bug
Date Tue, 28 Jul 2009 18:32:54 GMT
Actually this not a bug. It is intentional. The mapped statements can vary
in their use and believe it or not <select> may get used without a return
result. There were some fringe cases where it made sense to not specify the
resultXXX. I know it is annoying. But, it is on purpose. Just remember to
always specify a result :)
Brandon


On Tue, Jul 28, 2009 at 1:27 PM, Trenton D. Adams <trenta@athabascau.ca>wrote:

> I'm also seeing this problem on queryForList, but I don't know how to
> resolve it.
>
>  <select id="select_asn" parameterClass="java.util.Map"
>          resultClass="java.util.ArrayList">
>     SELECT spriden_pidm
>      FROM spriden,
>           spbpers
>     WHERE spriden_pidm             = spbpers_pidm
>        AND spbpers_vetc_file_number = #asn#
>        AND spriden_change_ind IS NULL
>  </select>
>
> This returns an empty list, but it should not.  It should either be
> throwing an error, or returning my list.
>
> What can I do to resolve this one?  This is what I'm doing...
>            parameters.put("asn", "2323232");
>            result = sqlMapper.queryForList("select_asn", parameters);
>            System.out.println("map: " + result);
>
> Thanks.
>
> Trenton D. Adams
> Systems Analyst/Web Software Engineer
> Navy Penguins at your service!
> Athabasca University
> (780) 675-6195
> :wq!
>
> ----- "Trenton D. Adams" <trenta@athabascau.ca> wrote:
>
> > From: "Trenton D. Adams" <trenta@athabascau.ca>
> > To: user-java@ibatis.apache.org
> > Sent: Tuesday, July 28, 2009 12:13:39 PM GMT -07:00 US/Canada Mountain
> > Subject: queryForMap bug
> >
> > Hi Guys,
> >
> > I found a kind of annoying bug, which took me a few minutes to track
> > down...
> >
> > If I do a query for map on this, it returns an empty map.
> >   <select id="select_asncount" parameterClass="java.util.Map">
> >     SELECT spriden_pidm
> >       FROM spriden,
> >            spbpers
> >      WHERE spriden_pidm             = spbpers_pidm
> >        AND spbpers_vetc_file_number = '2323232'
> >        AND spriden_change_ind IS NULL
> >   </select>
> >
> > If I do it on this, it works just fine.
> >   <select id="select_asncount" parameterClass="java.util.Map"
> >           resultClass="java.util.Hashtable">
> >     SELECT spriden_pidm
> >       FROM spriden,
> >            spbpers
> >      WHERE spriden_pidm             = spbpers_pidm
> >        AND spbpers_vetc_file_number = '2323232'
> >        AND spriden_change_ind IS NULL
> >   </select>
> >
> >
> > If it is an error to not have a resultXXX attribute, then it should
> > throw an exception, not return an empty list.  I am using a maven
> > dependency...
> >     <dependency>
> >       <groupId>org.apache.ibatis</groupId>
> >       <artifactId>ibatis-sqlmap</artifactId>
> >       <version>2.3.4.726</version>
> >     </dependency>
> >
> > Trenton D. Adams
> > Systems Analyst/Web Software Engineer
> > Navy Penguins at your service!
> > Athabasca University
> > (780) 675-6195
> > :wq!
> >
> > __
> >     This communication is intended for the use of the recipient to
> > whom it
> >     is addressed, and may contain confidential, personal, and or
> > privileged
> >     information. Please contact us immediately if you are not the
> > intended
> >     recipient of this communication, and do not copy, distribute, or
> > take
> >     action relying on it. Any communications received in error, or
> >     subsequent reply, should be deleted or destroyed.
> > ---
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message