Bug 282595

Summary: A read-only EntityManager that always returns read-only objects instead of cloned objects would be very nice -> no cloning and no GC overhead for read-only queries -> huge performance improvement
Product: z_Archived Reporter: Martin S. <zebhed>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: jamesssss, martin.grebac
Version: unspecifiedKeywords: performance
Target Milestone: ---   
Hardware: All   
OS: All   
URL: http://www.nabble.com/JPA-non-transactional-method-and-entity-access%3A-Do-I-get-a-reference-to-the-entity-or-a-clone-of-the-entity-in-the-session-cache--td22790869.html
Whiteboard:

Description Martin S. CLA 2009-07-06 20:12:46 EDT
In practice data is read more often than created, updated or deleted. In EclipseLink/JPA we will always get a clone back from any find() or query. But this can be very expensive, because first the entity in the session cache must be cloned and second it must be garbage collected again. This is not necessary if the data is only read.

It would be nice if there was an entity manager that always returns read-only objects (references to the objects in the session cache) instead of cloned objects. In practice, such an entity manager would be used for all read operations. This would be a huge performance improvement because it avoids cloning and garbage collection completely.

---

Please also take a look at this:

http://www.nabble.com/JPA-non-transactional-method-and-entity-access%3A-Do-I-get-a-reference-to-the-entity-or-a-clone-of-the-entity-in-the-session-cache--td22790869.html
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:09:15 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:16:42 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink