ClassCast Exception when doing a merge on a detached object

1 message Options
Embed this post
Permalink
vinay.venkat

ClassCast Exception when doing a merge on a detached object

Reply Threaded More More options
Print post
Permalink
Hi,
       
I'm using Open jpa 1.0.1 and webshpere 6.1. I'm running into a unique problem when executing a merge on a detached obect. I have a parent class and two subclasses.

one of subclasses has a couple of one to many relationships as well.

I do a select on the parent, the actual instance could be any of the subclass. the object is then sent over to the client, the client updates the object and i then merge it back.

I then see this exception

        Caused by: java.lang.Exception: java.lang.ClassCastException: parent incompatible with child        at org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:242)
        at org.apache.openjpa.persistence.PersistenceException.writeObject(PersistenceException.java:100)
        at sun.reflect.GeneratedMethodAccessor475.invoke(Unknown Source)

       
the exception happens only when the subclass with the one-to-many relations has to be updated

can anyone tell me why this might be happening? all the classes are versioned on a timestamp


Thanks
Vinay