ECLIPSELINK-00195 With Embeddeds Even With eclipselink.cache.shared.default Is False
(Doc ID 1093720.1)
Last updated on MARCH 19, 2019
Applies to:
Oracle TopLink - Version 11.1.1.2.0 and laterInformation in this document applies to any platform.
Symptoms
JPA Embeddeds are always set to shared=true (isolated=false) and do not pick up defaults or their parent's shared setting. They should probably inherit the isolation of their parent at all times. When eclipselink.cache.shared.default is set to false, any relationship from an Embedded to a non-shared Entity will trigger a validation exception.
Entity Object Model
Publisher references Embeddable Address
Address has a OneToOne mapping to City
The persistence.xml defines:
<property name="eclipselink.cache.shared.default" value="false" />
Problem Scenario
- Just starting the persistence context will reproduce the problem
public static void main(String[] args) {
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("example");
EntityManager em = emf.createEntityManager();
em.close();
emf.close();
}
Observed Behavior
Exception [EclipseLink-195] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DescriptorException
Descriptor Exceptions:
---------------------------------------------------------
Exception [EclipseLink-195] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The shared class model.Address must not reference the isolated class model.City.
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[city]
Descriptor: RelationalDescriptor(model.Address --> [DatabaseTable(PUBLISHER)])
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Entity Object Model |
Problem Scenario |
Observed Behavior |
Cause |
Solution |
References |