-->
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: Selecting the row number
PostPosted: Fri Jul 15, 2011 6:56 am 
Newbie

Joined: Wed May 04, 2011 2:24 am
Posts: 10
Hello,

Is there any way to select an absolute row number? This is a database feature required for searching when using pagination.

A practical example would be an end-user searching for a name that starts with 'J'. The application wants to know on which pages the records with 'J' exists, so it can jump to the page and provide options like search next and search previous.

In classic SQL, the queries would look like this:
Code:
SELECT t1.row_number
FROM (
    SELECT name,
    ROW_NUMBER() OVER (ORDER BY [CURRENT_ORDER]) AS row_number
    FROM customers
    WHERE ([CURRENT_FILTERS])
) t1
WHERE (t1.name like 'J%')

This query would provide the absolute row numbers of the records matching the search query. The application will be able to determine on which page the records are, and will be able to provide search previous and search next functionality.

Is there any way to achieve this using Hibernate (JPA CriteriaQueries)?


Top
 Profile  
 
 Post subject: Re: Selecting the row number
PostPosted: Tue Jul 19, 2011 4:26 am 
Newbie

Joined: Wed May 04, 2011 2:24 am
Posts: 10
Any suggestions? This is a vital part of the application and so far i've not found a way to achieve this functionality.


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.