views:

418

answers:

2

I'm getting the strangest results. I have a class with a composite key. If i do the following query:

from LOVEJB l order by l.canonicalId desc

my results are not ordered by the 'canonicalId' column I asked for. Instead, the canonical id result is like:

823 823 822 823 ,,,

Can someone give me some pointers on how should I try to crack this? I already messed up with hashcodes and equals, I experimented with a new class, etc. to no avail.

A: 

What's the actual QUERY generated? Order is dictated by RDBMS. Turn on show_sql in Hib configuration and run that query manually.

Vladimir Dyuzhev
+1  A: 

I found out. My composite key had columns that were not part of the table's primary key. Thanks all.

Miguel Ping