-->
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.  [ 2 posts ] 
Author Message
 Post subject: Sorted Collections using java.util.Comparator
PostPosted: Thu Mar 10, 2005 7:02 am 
Newbie

Joined: Thu Jan 13, 2005 10:04 am
Posts: 18
Hibernate version:
Hibernate 2.1.7c

Hi,

I was wondering if anybody can tell me if it's possible to use Comparators if they are anonymous inner classes to sort a Set using the hibernate mapping?

<set
name="mySet"
lazy="true"
sort="Foo.SomeComparator">
...

I have tried a few ways of naming the Comparator that I'd like to use but keep getting a MappingException.

Currently, I am sorting programitically:

Arrays.sort(myArray, Foo.SomeComparator);

Thanks,

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 2:45 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
You cannot instantiate an anonymous inner class outside of it's initial declaration - it doesn't have a handle (thus the 'anonymous') and it valid only for the declaration. Hibernate (or any java class for that matter) is not going to be able to create an instance of it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.