-->
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.  [ 2 posts ] 
Author Message
 Post subject: saving BLOB to mySQL
PostPosted: Sat Oct 14, 2006 9:23 am 
Newbie

Joined: Sat Oct 14, 2006 9:08 am
Posts: 4
Hibernate version: 3.1

Name and version of the database you are using: mySQL 4.1

Hi,

I am having trouble working out how to store my byte array to a BLOB. The hibernate website only deals with version 1.2.3, i think...

I used myEclipse to generate the mapping files, but it mapped mySQL BLOB to java.util.String, so I changed it to java.sql.Blob, but I have found that the mySQL Connector/J driver doesnt provide public access to the Blob class.

So, with my byte[], csQ.getPic().getByteArray()

How do I get it into my questionImage field so I can get it into the DB?

<property name="questionImage" type="java.sql.Blob">
<column name="question_image"/>
</property>

Question q = new Question();
q.setQuestionNumber(i);
q.setQuestionText(csQ.getText());
q.setQuestionImage( //????... );

Please help, thank you...
Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 8:13 pm 
Newbie

Joined: Sat Oct 14, 2006 9:08 am
Posts: 4
well, i solved my own problem. and only i will ever know how i did it.


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

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.