Based on the code that has been provided I am making the assumption that you are mapping your OneToMany to a Set collection. If this is the case, a Set collection will not allow duplicates. In order to check for duplicates, an object that is getting placed in the Set needs to show how it is unique. Therefore the objects that are going into the Set collection need to implement the Comparable (Sorry about IComparable) interface to be inserted. In this case, you would need object B to implement the Comparable interface. You would not need object A to implement Comparable as the comparisons are done on the instances of object B. If you are still getting cast errors, then it is probably something else. You could also try changing the Set collection type to a List to see if you get this error and you would not need to implement the Comparable interface. Remember that a List collection can contain duplicates.
-----Original Message----- From: Udi [mailto:[email protected]] Sent: Sunday, January 17, 2010 1:07 AM To: [email protected] Subject: RE: ClassCastException in pcReplaceField P.S. - I forgot to mention that I'm enhanching at runtime using javaagent. -- View this message in context: http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4407523.html Sent from the OpenJPA Users mailing list archive at Nabble.com. 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.
