[ 
http://nagoya.apache.org/jira/browse/IBATIS-21?page=comments#action_56264 ]
     
Harold Neiper commented on IBATIS-21:
-------------------------------------

inconsistent behavior found, this code is being deployed to solaris and i found 
that the same code that does not work on my local [win] box works just fine on 
the solaris deployment (i.e. without the conversion of BigDecimal to String 
when looking up an entry where the keys are stored as BigDecimal) and the 
deployment has the - same jars, same jdk, same db, only difference being is 
running tomcat 5.0.27 on solaris and 5.0.28 locally

further, I am outing this to the console just to see what the class type is of 
the key being stored in the Map using this --> System.out.println("the class 
for key " +ky + " is " + ky.getClass());

on my local box the result is this output:
...the class for key 1 value is java.math.BigDecimal
...key list [1]
...contains user 1 false

on the solaris box the result is this output:
...the class for key 1 value is java.lang.String
...key list [1]
...contains user 1 true

debugging further...

> Fixed JDBC types being ignored for hashmap result map
> -----------------------------------------------------
>
>          Key: IBATIS-21
>          URL: http://nagoya.apache.org/jira/browse/IBATIS-21
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Versions: 2.0.8
>  Environment: JDK 1.4, Tomcat 5.0.27, Spring 1.1, Oracle 9i
>     Reporter: Harold Neiper

>
> I am populating a Map instance [HashMap] and trying to set the java type for 
> the return value of the first column in my result map.  The column type in 
> the DB is Number and is currently returning as java type BigDecimal.  
> However, I would prefer that it be set to a String type in my result map.  
> In the developer guide the javaType is listed as optional.  However, it is 
> unclear as to whether these options are only available for Result Maps that 
> are mapping to JavaBean properities or for the likes of all types of Result 
> Maps (in this case a Map instance).
> Here is my result map below:
>       <resultMap id="authenticatedUserResult" class="java.util.HashMap">
>               <result property="_userId" column="app_user_objid" 
> javaType="string"/>
>               <result property="_userAuthInfoId" 
> column="app_user_auth_info_objid"/>
>               <result property="_userName" column="user_id"/>
>               <result property="_userPassword" column="encrypted_pwd_txt"/>
>               <result property="_userValidFlag" column="valid_flag"/>
>       </resultMap>
> Here is the mapped statement:
>       <select id="getAuthenticatedUser"
>                       parameterClass="java.util.Map" 
>                       resultMap="authenticatedUserResult"> 
>               select au.app_user_objid
>                          , auai.app_user_auth_info_objid
>                          , au.user_id
>                          , auai.encrypted_pwd_txt
>                          , auai.valid_flag
>               from   app_user au
>                          , app_user_auth_info auai
>               where au.user_id = #_userName#
>                         and auai.app_user_fk = au.app_user_objid
>       </select>
> And the dao code:
>       public Map getAuthenticatedUser(Map userMap) 
>               throws DataAccessException {
>               
>               return (HashMap) 
> getSqlMapClientTemplate().queryForObject(SQL_MAP_GET_AUTHENTICATED_USER,     
> userMap);
>       }
> thx - harold

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to