openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <>
Subject Re: openJPA detached object can not be serialized by Castor. is it related with pcStateManager?
Date Wed, 15 Apr 2009 01:31:04 GMT

  try the following configuration [1]
<property name="openjpa.DetachState" value="loaded(DetachedStateField=false)"/>

  OpenJPA detached object instance x (optionally) can carry a StateManager (pcStateManager)
instance sm(x) which can track changes in  x while x is not under OpenJPA managed context.
This makes merging of x into a OpenJPA managed context more effective. 

  The above configuration makes the detached instance x' serialization compatible with original

  Serialization behavior does change based on the detach state configuration and most likely
not liked by Castor's marshaller.

  To narrow the cause, you should also enhance your domain classes at build-time [2]. 


1. Environment: 
    java1.5, OpenJPA 1.2.1 , castor 1.2

2. any object retrieved from database by OpenJPA cannot be serialized to xml by castor.  No
error message from org.exolab.castor.xml.Marshaller  .  The result xml file is completely

3. When the same persistent class is instantiated by "new" operator,  the instantiated object
can be serialized by castor.

4. The only different between "openJPA detached objects" and "new instantiated objects" is
the "openJPA detached objects" has member pcStateManager = null.

  1. is this behavior related the pcStateManager member in the detached persistent objects?
  2. What is the purpose of pcStateManager ?  
  3.How does it affect the serialization behavior ?

Pinaki Poddar            
OpenJPA PMC Member/Committer
JPA Expert Group Member
View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message