ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: How to force Integer instead BigDecimal with queryForMap for the value part ?
Date Tue, 30 Aug 2005 13:00:51 GMT
A couple of options:
 1) use resultMap instead of resultClass
 2) use a bean instead of a Map

Using resultClass=Map, you get whatever JDBC sends back - which in
this case is a BigInteger.

My vote would be to use both a bean and a result map - the behavior is
much more predictable, and you'll get slightly better performance.

Larry


On 8/30/05, erlend.bjorge@aftenposten.no <erlend.bjorge@aftenposten.no> wrote:
>  
> Hi there! 
>   
> I have a queryForMap like this: 
>   
> HashMap codes = (HashMap)
> sqlMap.queryForMap("retrieveAdminUserAccessCodes",
> "testUser", "CODE", "VALUE")); 
>   
> And the query like this: 
>   
>     <select id="retrieveAdminUserAccessCodes"
> resultClass="java.util.HashMap" parameterClass="String">
>         select
>           CODE,
>           VALUE
>         from ADMINUSERACCESS 
>         where ADMINUSERNAME = #value#
>     </select> 
>   
>   
> VALUE is NUMBER(5) in a Oracle 9.2 database, when I get it back, codes, 
> the VALUE part is of type BigDecimal, is it possible to get it as an Integer
> instead ? hmm 
>   
> Or is it other ways to do this in a better way ? 
>   
>   
> Thanks! 
> Erlend

Mime
View raw message