-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Writing blob fields
PostPosted: Fri Oct 29, 2010 1:47 am 
Newbie

Joined: Thu Oct 28, 2010 8:38 am
Posts: 4
Location: Ukraine
I have some problem with inserting a blob field.

field declaration:
....
private byte[] b_data=new byte[]{};
....

field mapping:
....
<property column="b_data" name="b_data" type="java.sql.Blob"/>
....

insering:
....
Revision r = new Revision();
r.setI_entity(new Long(1));
r.setI_operation(new Long(1));
r.setI_record(new Long(1));
r.setB_data("1111".getBytes());
HibernateUtil.currentSession().save(r);
....

Exception:
Exception in thread "main" java.lang.ClassCastException: [B cannot be cast to java.sql.Blob
.....

Why?????


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.