It looks like you are trying to add items to a Set.  You will get these casting 
exceptions if your classes do not implement the IComparable interface.  If they 
do implement the interface, then it is another issue.

-----Original Message-----
From: Rick Curtis [mailto:curti...@gmail.com]
Sent: Thursday, January 14, 2010 5:02 PM
To: users@openjpa.apache.org
Subject: Re: ClassCastException in pcReplaceField

Udi -

You're really going to need to post more information than this for anyone to
figure out what is going on.... I understand you don't want to post your
application call stack, what about posting a filtered call stack? That might
be a good starting point.

You say you are enhancing your entities at runtime... is that via the
-javaagent or are you using the subclassing support?

--
Thanks,
Rick

On Thu, Jan 14, 2010 at 6:23 AM, Udi <saba...@gmail.com> wrote:

>
> Hey, first of all, I'm sorry for not pasting the stack - I just can't.
> I'm using OpenJPA 1.2.0
> I have 2 classes:
> class A{
> @OneToMany(mappedBy="a")
> Set
> }
> class B{
> @ManyToOne
> A a;
> }
>
> Now, at some point (I can't create a consistent testcase..) I get
> ClassCastException: B cannot be cast to A.
> The stack (typed, so sorry once again...):
> B.pcReplaceField()
> StateManagerImpl.replaceField()
> StateManagerImpl.storeObjectField()
> StateManagerImpl.storeObject()
> RelationFieldStrategy.load()
> FieldMapping.load()
> JDBCStoreManager.load()
>
> I'm enhancing entities at runtime, so I used decompiler to see the
> generated
> class, and in the problematic line it appears like a cast for a field.
>
> Anyone knows how can it happen (and even more interesting - how to solve
> the
> problem? :) )
>
> Thanks,
> Udi
> --
> View this message in context:
> http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4392185.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.

Reply via email to