Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top