-->
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: Prevent Update after sort...
PostPosted: Tue Nov 18, 2008 12:35 pm 
Newbie

Joined: Tue Nov 18, 2008 12:21 pm
Posts: 2
Hi all,

First, If this question has been answered, then quick guidance on where I could find the answer would be awesome! I checked, but maybe how i searched yielded no results.

Basically:

We have a view that allows us to go in depth on a resultset.

At one point, we can sort an inner set. However, the problem seems to be that Hibernate once hibernate has the chance, (ie: on a flush) it will simply re-save the whole thing because it noticed you changed to order of the set.

Is there a way to sort it and have hibernate not re-save? I could clone the resultset and simply sort that....However that seems counter productive.... :-/

Thanks guys :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 2:01 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
It is possible to specify a "sort" or"order-by" attribute in the mappings files. See http://www.hibernate.org/hib_docs/v3/re ... ons-sorted for examples. This assumes that you always want to use the same order.

You may also consider making the set inverse (eg. setting inverse="true" in the mapping file). But that assumes that you never need to use the set for updating the database.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 3:23 pm 
Newbie

Joined: Tue Nov 18, 2008 12:21 pm
Posts: 2
nordborg wrote:
It is possible to specify a "sort" or"order-by" attribute in the mappings files. See http://www.hibernate.org/hib_docs/v3/re ... ons-sorted for examples. This assumes that you always want to use the same order.

You may also consider making the set inverse (eg. setting inverse="true" in the mapping file). But that assumes that you never need to use the set for updating the database.


Exactly! It doesn't need to be updated. We really just want to set a specific order on the set. But then when it's changed, hibernate flags it and if anything else happens, it's re-written to the DB, when all we wanted to do was display it in a different order.

Are you saying that setting inverse = true in the mapping file means it won't save it on reverse sort of any column in the set?

Thanks for the quick feedback! :)


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.