Bug 282595 - 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
Summary: A read-only EntityManager that always returns read-only objects instead of cl...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL: http://www.nabble.com/JPA-non-transac...
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2009-07-06 20:12 EDT by Martin S. CLA
Modified: 2022-06-09 10:16 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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