-->
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.  [ 2 posts ] 
Author Message
 Post subject: size of query.list() timeout
PostPosted: Sat Sep 09, 2006 12:58 am 
Newbie

Joined: Sun Sep 03, 2006 1:21 am
Posts: 9
are there alternatives to find the size of query.list() instead of query.list().size()?

if the list is too big, transaction is timed out and got exception.

1 possible alternative is to replace the Select part of the query with Select count(*). Is this reasonable?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 09, 2006 6:38 am 
Regular
Regular

Joined: Mon Jun 13, 2005 12:21 pm
Posts: 61
Location: Hannover
There are several approaches to get the size of a list.
1. select cout(*) is ok, but forces you to a new select statement
2. try using a filter (http://www.hibernate.org/hib_docs/v3/re ... tipstricks)
3. use scrollable resultsets:
Code:
ScrollableResult scroll = query.scroll();
scroll.afterLast();
int size = scroll.rowNumber();
scroll.beforeFirst();


Which approach ist best, depends on your select.


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