-->
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.  [ 4 posts ] 
Author Message
 Post subject: Streaming into and out of the database
PostPosted: Mon Aug 29, 2005 6:35 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
I am wondering if there is any possible way to stream things into and out of the database using hibernate? My situation is I have potentially large blob objects, that are large enough that I cannot afford the memory to hold onto two copies in memory, thus i would like to stream to/from the database, and only ever hold 1 instance in memory. This can be accomplished using PreparedStatement/ResultSet.. is it doable with hibernate and mysql?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 7:31 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
Try query.scroll() with evicting objects

see the sample here...
http://www.hibernate.org/hib_docs/v3/re ... tch-update


Top
 Profile  
 
 Post subject: Re: Streaming into and out of the database
PostPosted: Mon Aug 29, 2005 10:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
halcyon wrote:
I am wondering if there is any possible way to stream things into and out of the database using hibernate? My situation is I have potentially large blob objects, that are large enough that I cannot afford the memory to hold onto two copies in memory, thus i would like to stream to/from the database, and only ever hold 1 instance in memory. This can be accomplished using PreparedStatement/ResultSet.. is it doable with hibernate and mysql?


Usual way to handle this stuff is to map the property as type java.sql.Blob (Hibernate type "blob"), and let your JDBC driver take care of the streaming.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 11:03 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
The problem I'm running into right now is I have it set to a clob (soon to change), and a string on the pojo. When I profile the app with a ~1meg clob I'm getting 6meg in char[] allocations from PreparedStatement.setString (coming down from dehydrate), and then ~1meg in byte[] allocations from PreparedStatement.fillSendPacket... so I need to get that down as much as possible, any ideas? I'm using MySQL 4.1.x for reference.


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