-->
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.  [ 13 posts ] 
Author Message
 Post subject: Large one-to many list
PostPosted: Wed Jun 23, 2004 8:01 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Hello,
How I can resolve problem when list in one-to-many relationship is large ?

For instance order with > 10000 items

regards
Haris Peco


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 12:23 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
lazy="true"

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 2:49 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
and when I access to items will I get all items or for instance only 100 items ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 2:49 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
All, of course.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 2:54 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Fine, but I want only <= 100 rows - How I can do this ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 2:55 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You probably need "pagination", search the documentation.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 3:00 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I know for pagination (and scrolling resultses, too), but my question is :

Can I set any mapping property and that Hibernate don't load all items in collection than load btw. <= 100 and scroll automatic when is necessery, like
ResultSet in JDBC with setFetchSize

regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 3:06 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, not if you are using lazy loading. Use an explicit fetch.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 4:36 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I don't worry about lazy - only that <= xxx rows be in memory

When I set fetch in hibernate cfg, hibernate use fetch for database access, but collection is complete full always

I want that when I access to collection items, hibernate have <= xxx items in memory and load rest of items when I get it

For instance : orders items have > 10000 rows ( I can get all 10000 rows in
memory - VM return OutOfMemory)

I access to items 1 and hibernate have in memory 1-100 rows, when I access to row 101 hibernate load next 100 rows from database etc

I can resolve this with scrollable ResultSet, but I want that hibernate do it with for instance

<set ....
maxRows="100" />

regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 4:38 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It doesn't exist, but you can of course write a patch and submit it to JIRA.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 6:19 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
It is features wish - I know write helper class for me , which use scrollable results, but I don't know add it to hibernate - it have to be, probably, special collection (LargeList or LargeSet)

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 6:21 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Note that you can also use pagination using a collection filter. Actually, I've never seen a request like yours, because most of the issue you have can be solved with criteria, HQL, and/or filters.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 6:52 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
If you think on criteria.setMaxResults, it don't work with Oracle 8.0,
but it isn't important.
I know that I can resolve this problem,but I want that Hibernate work this (with declaration in mapping file)
I don't know why You haven't request like this, but large query are often
and I want next form Hibernate
give me "normal" collection, but I want that only <= xx items are in memory - I can do it (with HQL,criteria, scroll resultset etc), but I declare it and forget .
regards


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