[ http://issues.apache.org/jira/browse/IBATIS-21?page=history ]
Clinton Begin closed IBATIS-21:
-------------------------------
Assign To: Clinton Begin
Resolution: Cannot Reproduce
Can't reproduce, nobody confirmed. This looks like a platform or JDBC driver
issue. My recommendation: Don't use maps if you care about type safety.
> Fixed JDBC types being ignored for hashmap result map
> -----------------------------------------------------
>
> Key: IBATIS-21
> URL: http://issues.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
> Assignee: Clinton Begin
> Priority: Minor
>
> 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://issues.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