Honestly, you are probably correct in that all you need is a hashCode and equals for a Set. I guess the real question is, what implementation of Set is being returned by OpenJPA? If it is a TreeSet (most common), then we are on the same page since TreeSet is an implementation of an ordered collection with the following hierarchy.
Set -> SortedSet -> NavigableSet -> TreeSet I guess I am saying that you would need to use Comparable because I have not used any of the other implementations and TreeSet is the most common. -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Thursday, January 21, 2010 9:45 PM To: [email protected] Subject: Re: ClassCastException in pcReplaceField Hi, On Jan 21, 2010, at 7:23 PM, Russell Collins wrote: > While the initial thought is that the "equals()" method would work, > the specification for Set requires a compareTo method be present by > implementing the Comparable interface. This is not my understanding. Set requires only hashCode and equals. Ordered collections (e.g. TreeSet) require the elements to implement Comparable or to have a Comparator specified at creation. Maybe we're reading different parts of the spec... Craig Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp! CONFIDENTIALITY NOTICE: The information contained in this electronic mail (email) transmission (including attachments), is intended by MCLANE ADVANCED TECHNOLOGIES for the use of the named individual or entity to which it is addressed and may contain information that is privileged, confidential and/or protected as a trade secret. It is not intended for transmission to, or receipt by, any individual or entity other than the named addressee(s). If you have received this email in error, please delete it (including attachments) and any copies thereof without printing, copying or forwarding it, and notify the sender of the error by email reply immediately.
