-->
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.  [ 5 posts ] 
Author Message
 Post subject: inserting Blob
PostPosted: Mon May 02, 2005 1:14 am 
Newbie

Joined: Mon May 02, 2005 12:56 am
Posts: 17
Can anyone tell me how to insert a BLOB into a table using hibernate?

Thanks,
Shrimon.


Top
 Profile  
 
 Post subject: how to insert blob file using
PostPosted: Tue May 03, 2005 5:03 am 
Newbie

Joined: Fri Apr 29, 2005 4:58 am
Posts: 12
Location: Chennai INDIA
Please Refer the same. U will find comfortable

http://www.theserverside.com/discussion ... d_id=20386


Top
 Profile  
 
 Post subject: Re: how to insert blob file using
PostPosted: Tue May 03, 2005 5:07 am 
Newbie

Joined: Fri Apr 29, 2005 4:58 am
Posts: 12
Location: Chennai INDIA
Within a Java program you can retrieve or set data from a BLOB or CLOB using the standard JDBC BLOB and CLOB interfaces. For example

Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT MyCLOB,MyBLOB FROM MyTable");
rs.next(); // fetch the Blob/Clob

java.sql.Clob clob = rs.getClob(1);
java.sql.Blob blob = rs.getBlob(2);

// Length
System.out.println("Clob length = " + clob.length());
System.out.println("Blob length = " + blob.length());


------------------------------------------

Please Refer the same. U will find comfortable

http://www.theserverside.com/discussion ... d_id=20386[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 03, 2005 5:11 am 
Newbie

Joined: Mon May 02, 2005 12:56 am
Posts: 17
Thanks for your reply.

But how do you insert a blob using hibernate?


Thanks
Shrimon.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 03, 2005 7:45 am 
Senior
Senior

Joined: Mon Apr 04, 2005 8:04 am
Posts: 128
Location: Manchester, NH USA
You need to create a CustomUserType - try looking at how Spring does it (www.springframework.org) - you can take or reimplement the Blob user type from there to work in your project. Note also if you're using Oracle that Oracle has some special considerations wrt Blobs.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.