-->
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.  [ 1 post ] 
Author Message
 Post subject: Efficiency on Collections or List
PostPosted: Fri Apr 07, 2006 4:29 am 
Newbie

Joined: Fri Apr 07, 2006 2:14 am
Posts: 4
I've read the documentation of hibernate and I found this:

"Sometimes we need to ensure that a proxy or collection is initialized
before closing the Session. Of course, we can alway force
initialization by calling cat.getSex() or cat.getKittens().size(), for
example. "

My questions are:

0. From the above statement, does it means when I call load(SomeClass.class) to get all data even though lazy=true, and I call size() method over the lazy collection (e.g. 1 million rows), then the whole data (1 million rows) will be initialized? Isn't it so much for
retrieving size of collection.

1. When it is specified lazy=true, collection retrieval by select query nor doing filter(SomeClass.class) then list() nor by getChildren() (one to many assoc) won't initialize the collection after the call of size() over the collection, right?

2. Is it okay if I call load(SomeClass.class) to get list of all records even though I just want to show some rows? Does Hibernate have default batch size that suitable for paging problem?

e.g. when I do batch=10 then do filter(SomeClass.class).list(), Hibernate just populate 10 rows into the (hibernate own implementation) collection? But, when we call coll.get(14), the hibernate will select next 10 rows. Am I right?


I'm still searching for best efficiency in hibernate. I hope you have time to answer my questions or give any references.

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.