-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Queries: How do i do a select count(*) ...
PostPosted: Mon Sep 06, 2004 10:17 am 
Newbie

Joined: Tue Aug 24, 2004 11:36 am
Posts: 2
Hi, I'm new to Hibernate. Would like to ask a pretty simple question.

How do i query for the total number of rows in a table. Like a select count(*) ..

This is a Pagination related question, where i have used the sample Page class implementation provided by Gavin King. However, would like to make some modifications, where instead of simply allowing for a next and previous, would like to present the total number of pages to be displayed.
So that the presentation tier could request for a specific page.

Therefore for the initial request, would like to return along with the first pages results, the total number of pages. (hence the request for how to perform the select count(*)... ) I would not want to fetch all the objects, instead just return an int or something with the total number of rows matching my query.

Thanks in advance.
Roshan

Hibernate version:
Hibernate version 2.1.6

DB : DB2 8.1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 06, 2004 12:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
RTM especially the 11.13. section

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 1:03 am 
Newbie

Joined: Tue Aug 24, 2004 11:36 am
Posts: 2
Thanks. It works.


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