-->
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.  [ 7 posts ] 
Author Message
 Post subject: how do query.list() use cache?
PostPosted: Mon Aug 07, 2006 10:06 pm 
Newbie

Joined: Mon Aug 07, 2006 9:51 pm
Posts: 3
I know Query.iterator() use cache,but I don't konw Query.list() how use cache.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 10:33 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Same way. Query.iterator() = Query.list().iterator().

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 11:52 pm 
Newbie

Joined: Mon Aug 07, 2006 9:51 pm
Posts: 3
I see.
I didn't like iterator.Because it load recorders one by one.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 12:07 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Ah, I see what you mean. Query.iterator() uses scrollable result sets if it can, allowing you to defer loading. Query.list() will load all entities that you query for, before the call to list() returns. It won't do anything special about eagerly loading associated entities: you have to write your query to do that, if that's what you need.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 1:09 am 
Newbie

Joined: Mon Aug 07, 2006 9:51 pm
Posts: 3
thanks very much.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 1:10 pm 
Newbie

Joined: Sat Aug 05, 2006 2:49 am
Posts: 3
tenwit wrote:
Ah, I see what you mean. Query.iterator() uses scrollable result sets if it can, allowing you to defer loading. Query.list() will load all entities that you query for, before the call to list() returns. It won't do anything special about eagerly loading associated entities: you have to write your query to do that, if that's what you need.


Maybe you can help answer a somewhat related issue I'm having. When I call Query.list(), I get a collection back, but the elements in the collection are null... I haven't been able to figure out how to resolve this for almost a week.

Any advice is appreciated!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 6:14 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Post your mapping. Possibly in a new topic.

_________________
Code tags are your friend. Know them and use them.


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