-->
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.  [ 1 post ] 
Author Message
 Post subject: pagination and sorting
PostPosted: Sun Aug 10, 2008 8:55 pm 
Newbie

Joined: Sun Aug 10, 2008 8:06 pm
Posts: 1
I have an application where there is a parent with 10 children. Every children has composite keys(which includes the parent ID and a seq number).
I have a scenario where I need to display results 15 per page and allow user to sort by certain items(Couple of items are columns in child table).
I am able to achieve this functionality but performance is pretty bad. I am using Hibernate Criteria to retrieve all records first, sort them using java comparators and displaying on the page. Every click has an interaction with database.

EX:
Parent
A listing has listingID as primary key
Code Table
Beds --> bedID and Bed Name as columns
Child
ListingBeds --> listingID and BedID as composite key.
Code Table
Activities --> activityID and Activity Name as columns
Child
ListingActivities --> listingID and activityID as composite key.

Most of the columns that I am getting are from parent table and couple cols from child tables.

Best approach I think, is to use setFirstResult, setMaxResults and order by a column.
I did not find a way to order by a child column. Can anybody help me out in this regard.

Any help is greatly appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.