ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: Problem with BLOB
Date Mon, 19 Sep 2005 14:28:03 GMT
Sanjay,

What is the column type in the database?

And have you had a chance to look at http://opensource2.atlassian.com/ 
confluence/oss/display/IBATIS/How+do+I+use+a+BLOB+or+CLOB

Nathan

On Sep 19, 2005, at 6:48 AM, Sanjay Goel wrote:

> The result map looks like this:
>     <resultMap class="AuditVO" id="audit">
>         <result property="id" column="TF_AUDIT_ID"></result>
>         <result property="accId" column="SS_CLIENT_ACC_ID"></result>
>         <result property="message" column="CHAR_DATA"></result>
>     </resultMap>
>
> and AuditVO class has
>     private Integer id;
>     private int accId;
>     private byte []  message;
> and the getter setter methods.
>
> the querys are
>     <select id="getAudit" resultMap="audit" parameterClass="AuditVO" >
>         SELECT TF_AUDIT_ID, SS_CLIENT_ACC_ID, CHAR_DATA FROM  
> tf_audit WHERE TF_AUDIT_ID = #id#
>     </select>
>
>     <insert id="insertAudit" parameterClass="AuditVO">
>         INSERT INTO tf_audit (TF_AUDIT_ID, SS_CLIENT_ACC_ID,  
> CHAR_DATA, LAST_UPDATED) VALUES ( #id# , #accId# , #message# ,  
> SYSDATE )
>     </insert>
>
>         <update id="updateAudit" parameterClass="AuditVO">
>             UPDATE tf_audit SET CHAR_DATA=#message# WHERE  
> TF_AUDIT_ID=#id#
>         </update>
>
> On 9/19/05, Daniel Henrique Ferreira e Silva <dhsilva@gmail.com>  
> wrote:
> Sanjay,
>
> Are you using a custom type handler?
> How are your config map files?
>
> Cheers,
> Daniel Silva.
>
> On 9/19/05, Sanjay Goel <sanjay.goel@gmail.com> wrote:
> > Hi,
> >  I am trying a save a String in an oracle BLOB object (I know  
> String can be
> > mapped to CLOB, but lets say I can't use CLOB) ...
> >  I have a VO with a field as byte [] which is mapped to the BLOB.  
> I do a
> > String.getBytes() to get the byte array and save it in BLOB and  
> retrieve it
> > using new String(byte []) ...
> >  the problem is, the string returned is garbage. Anyone has an  
> idea why this
> > happens ?
> >  Regards,
> >  Sanjay
> >
>


Mime
View raw message