openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Struberg (JIRA)" <>
Subject [jira] Updated: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true
Date Thu, 02 Dec 2010 11:20:10 GMT


Mark Struberg updated OPENJPA-1900:

    Attachment: OPENJPA-1900-test-1.patch

I tried to reproduce my problem with an unit test but had no luck so far. But the test now
crashes with another issue.

testSerialization(org.apache.openjpa.persistence.proxy.TestEntitySerialize)  Time elapsed:
14.822 sec  <<< ERROR!
	at org.apache.openjpa.persistence.proxy.TestEntitySerialize.testSerialization(

The situation:
I added a 'previousAnnuity' to reflect the existence of a annuity predecessor. 
The data I create is a FixedAnnuity which gets superceeded by an EquityAnnuity.
I then load the last annuity (the EquityAnnuity) in one transaction. While having the EntityManager
open, the previousAnnuity is available. But if I close the EntityManager, it suddenly dissapears
(field get's reset to null).

Is this a spec like behaviour that entity members get deleted while closing the EntityManager?

> ClassCastException when serializing an entity if DetachedStateField=true
> ------------------------------------------------------------------------
>                 Key: OPENJPA-1900
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0
>            Reporter: Mark Struberg
>             Fix For: 2.1.0
>         Attachments: OPENJPA-1900-test-1.patch
> When using 
> <property name="openjpa.DetachState" value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl cannot be cast
to org.apache.openjpa.kernel.DetachedStateManager
> 	at org.apache.openjpa.util.Proxies.writeReplace(
> 	at$util$Date$proxy.writeReplace(Unknown Source)
> 	at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> 	at java.lang.reflect.Method.invoke(
> 	at
> 	at
> 	at
> 	at org.apache.openjpa.kernel.SingleFieldManager.serialize(
> 	at org.apache.openjpa.kernel.StateManagerImpl.writeDetached(
> 	at
> 	at
> This seems related to OPENJPA-1597

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message