ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <erlend.bjo...@aftenposten.no>
Subject SV: How to force Integer instead BigDecimal with queryForMap for the value part ?
Date Tue, 30 Aug 2005 13:40:11 GMT
Hi there!

>A couple of options:
>1) use resultMap instead of resultClass

I did think about that, but can you do that ?

I did try like this:

    <resultMap id="adminUserAccessCodesResult" class="java.util.HashMap">
        <result property="key"          column="KEY"/>
        <result property="value"        column="VALUE"          jdbcType="NUMERIC" javaType="java.lang.Integer"/>
    </resultMap>

    <select id="retrieveAdminUserAccessCodes" resultMap="adminUserAccessCodesResult"  ...>

But, the HashMap now is empty with a null object (size = 1) .. Meaning can't populate the

fieldes... As I thought ... Since you don't have set'ers for the key and value for an HashMap.

But it was not like this you meant ?

---

>2) use a bean instead of a Map

It was ment to be like this

AdminuserBean

Name,
Phone,
accessCode   (as an HashMap)
...

So I was hopeing to use the queryForMap directly, instead of manualy populate it afterwards.

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

I see ... Yes thougth it could be like that.

So can you explain what you meant by useing a resultMap with HashMap ??


Thanks again!


Cheers,
Erlend

Mime
View raw message