BLOB retrieve 
--------------

         Key: IBATIS-44
         URL: http://issues.apache.org/jira/browse/IBATIS-44
     Project: iBatis for Java
        Type: Bug
  Components: SQL Maps  
    Versions: 2.0.9    
 Environment: windows xp
jdk 1.4.2 
oracle 9i
ojdbc14_g.jar

    Reporter: Alexandru Barbat


It seems it doesn't retrieve correctly BLOB fields from db.

the "conversion" from (db type) BLOB to byte[] (java type) it is not working as 
expected.


code extract"

map look something like this

...
 <resultMap id="sea-levels-result" class="sea">
  <result property="idSea" column="IDSEA"/>
  <result property="value" column="SEA_LEVEL"/>
  <result property="dsca" column="DSCA"/>
  <result property="image" column="IMG" />
 </resultMap>

 <select id="getSeaLevels" parameterClass="string" 
resultMap="sea-levels-result">
   select IDSEA as IDSEA,
        SEA_LEVEL as SEA_LEVEL,
        DSCA as DSCA,
        IMG 
   from SEA
   where ID=#value#
 </select>
...

property "image" has byte[] type and column "IMG" has BLOB type


the call is something like this:
...
 List res = getSqlMap().queryForList("getSeaLevels", id);
..

the problem is that in the propery 'image' of class 'sea' I will find 86 bytes 
(but in reality are only 10)

and those 86 bytes are not the same at all with those 10.  

If somebody could help I'll appreciate. 
I have searched for a similar example but I didn't found any.

ps
the update to a BLOB field seems to work very well.


Thanks.





-- 
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

Reply via email to