• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compareTo of Comparable not being called

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have the following PK class:



This is the relation/mapping:



The above annotation will not call the compareTo method...

I use toplink.

Can anyone help please?

Julien.
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Julien,

If I understand your question correctly, you are expecting the compateTo to be called because you are using @OrderBy annotation.

In my opinion the @OrderBy annotation is used when the query is computed. If you check your generated sql, it should have the order by clause.

If you want the compareTo to be called, you will have to use the java.util.Collections class's sort method and pass the list of AccountPK to it.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic