Community
Participate
Working Groups
Build Identifier: version: Eclipse Persistence Services - 2.1.2.v20101206-r8635 If a POJO has a 1-1 relationship using a custom ValueHolder then the Object cannot be serialized as the EclipseLink Class ContainerIndirectionPolicy in the package org.eclipse.persistence.internal.indirection has an attribute for Constructor which is not marked as transient. the current code is private Constructor containerConstructor; It should be private transient Constructor containerConstructor; Reproducible: Always Steps to Reproduce: 1. create a POJO with 1-1 Valueholder indirection relationship 2. Start a UOW 3. Register a new instance of the POJO 4. Write the uow to a file 5. read it from the file 6. commit Step 4 will cause an error - java.lang.RuntimeException: Serialization error: java.io.NotSerializableException: java.lang.reflect.Constructor
For step 4, do you mean that the UnitOfWork itself should be serialized to a file? UnitOfWork is not Serializable. Or serialize the clone that is returned from the UnitOfWork to a file? Perhaps a code example to illustrate the problem?
(In reply to comment #1) > For step 4, do you mean that the UnitOfWork itself should be serialized to a > file? UnitOfWork is not Serializable. > > Or serialize the clone that is returned from the UnitOfWork to a file? > > Perhaps a code example to illustrate the problem? I mean serialize the clone that is returned from the UnitOfWork to a file.
(In reply to comment #2) > (In reply to comment #1) > > For step 4, do you mean that the UnitOfWork itself should be serialized to a > > file? UnitOfWork is not Serializable. > > > > Or serialize the clone that is returned from the UnitOfWork to a file? > > > > Perhaps a code example to illustrate the problem? > > I mean serialize the clone that is returned from the UnitOfWork to a file. I actually tried this with EclipseLink trunk and our testing framework (with ContainerIndirectionPolicy), and was not able to reproduce the problem. Could you please submit a small testcase demonstrating the issue, as well as details of the JDK version and vendor you are utilizing.
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
Targetting for our 2.3.3 release - the next open release. At the moment, based on some email discussions, I am assuming the goal is to serialize an instance of UnitOfWorkImpl that ocntains a mapping with a ContainerIndirectionPolicy. More details about exactly what you are doing and what the behavior you expect from the UnitOfWork when it is serialized will help ensure any test cases we build test your scenario.
Created attachment 214493 [details] Suggested patch Changing ContainerIndirectionPolicy's containerConstructor field to be transient - as was suggested by the filer. Added ContainerIndirectionPolicySerializationTest to eclipselink.core.test In TestingBrowser it's found under: LRG - FeatureTestModel - MiscellaneousTests
The patch checked into both trunk (2.4) and 2.3.3.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink