OpenJPA
  1. OpenJPA
  2. OPENJPA-1900

ClassCastException when serializing an entity if DetachedStateField=true

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.0, 2.2.0
    • Fix Version/s: 2.1.0, 2.2.0
    • Component/s: kernel
    • Labels:
      None

      Description

      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(Proxies.java:147)
      at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown Source)
      at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
      at org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
      at at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)

      This seems related to OPENJPA-1597

      1. OPENJPA-1900.patch
        17 kB
        Rick Curtis
      2. OPENJPA-1900-fix.patch
        0.8 kB
        Mark Struberg
      3. OPENJPA-1900-test-1.patch
        14 kB
        Mark Struberg

        Activity

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Mark Struberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development