-->
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.  [ 6 posts ] 
Author Message
 Post subject: Retrieving objects from a query lazily
PostPosted: Sun Jun 13, 2004 10:29 pm 
Beginner
Beginner

Joined: Sun Jun 13, 2004 9:49 pm
Posts: 38
I'm trying to find an O/R framework that can perform paging.

The first type would be a query that would retrieve rows from a database using an Iterator. When next() is called rows are feteched as needed. This is useful for a client app that retrieves more rows from a database when the user moves the them in a list within a certain distance from the bottom.

The next type would use a query that supports JDBC bookmarks. The query would perform paging and keep only enough rows to keep a scrolling window populated.

As you've probably guessed this is for client development not web. We have created are oun framework that implements the first type and this works well using SWT as the gui.

What we want to avoid is a use performing a query and then retrieving 10,000 rows when they don not scroll through and then fire off another and another.. You get my point.

Any help on this would be appreciated.

Thanks
Darren.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2004 4:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
query.iterate()
query.setMaxResults().setFirstResult()


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 9:31 am 
Beginner
Beginner

Joined: Sun Jun 13, 2004 9:49 pm
Posts: 38
Nics. Sorry about the delay in responding.

I'll give that a try.

I take it that this will hold a connection from the underlying connection manager?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 6:13 am 
Beginner
Beginner

Joined: Sun Jun 13, 2004 9:49 pm
Posts: 38
I've got this working, but i was shocked to see that when i iterate over a query, the first sql statement just retrieves the keys. Every time next is called, hibernate fires another SQL statement to get the object. This is sloooooow.

How can i make hibernate select all attributes on the first query.

Any help would be appreciated.

Darren.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 6:17 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Thats the point of iterate(), use it if you expect the data to be cached in the second level cache. Otherwise, wait for 2.1.5 (due in the next days) and use scroll().

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 11:00 am 
Beginner
Beginner

Joined: Sun Jun 13, 2004 9:49 pm
Posts: 38
Ahhhh, i'll wait for 2.1.5 then. Thanks.


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