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: How to return table size in Hibernate?
PostPosted: Fri Jul 02, 2010 4:15 am 
Newbie

Joined: Fri Jul 02, 2010 4:10 am
Posts: 3
I have a table with about 1500 records - and a service that needs to list them all.
However, this is very memory intensive since the objects are quite large - they contain a large chunk of XML in one of the columns.

What I want to do is get the number of records in the table without retrieving the list of records.
I will keep a record of the number of records in my application and only retrieve the records if new records are added.

Is it possible to get the number of records without having to bring back the records?


Top
 Profile  
 
 Post subject: Re: How to return table size in Hibernate?
PostPosted: Fri Jul 02, 2010 5:05 am 
Newbie

Joined: Fri Jul 02, 2010 4:10 am
Posts: 3
Did it with HQL -
Code:
select count(*) from table


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.