-->
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: ETL scenario, lazy fetch problem
PostPosted: Tue Aug 16, 2005 4:07 pm 
Newbie

Joined: Tue Aug 16, 2005 3:50 pm
Posts: 2
Location: Massachusetts, USA
I'm using Hibernate 3.1 to assist in an ETL scenario with a database.

The jist of my task is to perform a "select * from table" type query and process all of the results one at a time [details irrelevant]. That's what I'd do if I were using straight JDBC, anyway. The table has thousands of records; I can't afford to have them all in memory at once. I've read from the Hibernate documentation that the .iterate() call will result in N+1 queries! I want an O(1) algorithm (preferably exactly one query). The lazy fetching information I've read in the docs seem to apply to related tables but not the table (or "Enity") itself.

The main thing I'm trying to gain by using Hibernate in the first place is for it to map ResultSets to my objects (in a straight-forward manner). All SQL is legacy (and complicated!) and I don't need Hibernate figuring it out.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 5:52 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
We've been able to do this with scroll() method and clearing session or evicting objects as we go.

is this what you are looking for...
http://www.hibernate.org/hib_docs/v3/reference/en/html/performance.html#performance-sessioncache


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 8:23 pm 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
http://ibatis.apache.org/

iBATIS might be better suited to your application.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 9:28 am 
Newbie

Joined: Tue Aug 16, 2005 3:50 pm
Posts: 2
Location: Massachusetts, USA
Thanks for the tip at that URL. I looked into ScrollableResults but the docs didn't clearly say that the get(int):Object method is going to give me the mapped class of the ResultSet. I thought it would give me an array of primitive types for the ResultSet. The docs could use more clarity here.

I would love to use iBatis in this scenario; it is a perfect fit. Unfortunately, my project leader insists that we not use software that in any way overlaps with Hibernate's capabilities.


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.