-->
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: @Orderby and Set
PostPosted: Thu Jul 10, 2008 9:50 am 
Beginner
Beginner

Joined: Sat Apr 07, 2007 4:42 pm
Posts: 24
Hi,

I have declared this:

Code:
@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="fk")
@OrderBy("setId ASC, name ASC, setIndex ASC")
@JoinColumn(name="FK")
Set<CompoundPK> myset;


CompoundPK contains the strings setId, name and value.

The generated sql works fine, the order by is applied correctly.

But the resulting set is not always in the same order as the records from the resultset.
It seems to work if setId is a decimal string like 1, 2 or 3.
But if it is hex like 69, 6a, 6b the set order ist:

6a, 6b, 69.

What's wrong here?

Thank you.

P.S. I'm using Hibernate 3.2.6


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 11:28 am 
Beginner
Beginner

Joined: Sat Apr 07, 2007 4:42 pm
Posts: 24
edit


Last edited by spgmx on Thu Jul 10, 2008 11:34 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 11:31 am 
Beginner
Beginner

Joined: Sat Apr 07, 2007 4:42 pm
Posts: 24
New infos:

If I change it from Set to List the problem remains the same.

If I remove the @OrderBy it works because the database returns the records in the order they were inserted - but this is of course accidentally and may change from database to database.


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.