Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336651

Summary: protected embeddables annotated with @ElementCollection are not brought in cache
Product: z_Archived Reporter: Yiping Zhao <yiping.zhao>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Yiping Zhao CLA 2011-02-08 15:34:49 EST
I have expanded the jpa/cacheable model by adding CacheableRelationshipsEntity.java which is cacheable true, "protectedEmbeddables" in it is annotated with following:

@ElementCollection
	@CollectionTable(
        name="CACHREL_PROTECTEMB",
        joinColumns=@JoinColumn(name="ID")
)
public List<ProtectedEmbeddable> getProtectedEmbeddables() {
        return protectedEmbeddables;
}

In testCreateEntities(), an instance of ProtectedEmbeddable is added to instance of CacheableRelationshipsEntity, see here:

CacheableRelationshipsEntity prse = new CacheableRelationshipsEntity();
prse.addProtectedEmbeddable(pe);
em.persist(prse);

In the test testEmbeddableProtectedCaching(), the return collection is empty, no related ProtectedEmbeddable entity is brought to cache:

CacheableRelationshipsEntity cachedCRE = (CacheableRelationshipsEntity) session.getIdentityMapAccessor().getFromIdentityMap(cre);
System.out.println("====the size of the collection is " + cachedCRE.getProtectedEmbeddables().size());
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:07:48 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:16:04 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink