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: Id Based Sorting
PostPosted: Mon Mar 02, 2009 6:07 am 
Newbie

Joined: Mon Mar 02, 2009 5:46 am
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi All,

I have two tables example Codes and Type

The Type table id is foriegn key for Codes table.

I have a grid in my Web application.I want to list the type value in my list.It is working fine but while I am trying to sort my Type column.It is sorting based on Id and not value.

Example Table Values:

codes Table:
CodeId---1,2,3,4
TypeId----2,4,1,3(Foriegn Key)

Type Table:
TypeId----1,2,3,4
Value-----Inactive,Active,Deleted,Locked


Can Some one help me on this.
Thanks in Advance.


Feroz.K


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 02, 2009 7:10 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Depends on how you've mapped the types. If it's a collection without index column, you can add order-by="value asc" to the collection mapping. But if you use a indexed collection, you have to sort the values before saving.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 07, 2009 6:37 am 
Newbie

Joined: Mon Mar 02, 2009 5:46 am
Posts: 5
Thanks Wolfgang for your reply,

I have used diffeent logic for sorting.

Thanks again for your help


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.