Bug 563179 - Unregistered existing entity placed in L2 cache after existence check
Summary: Unregistered existing entity placed in L2 cache after existence check
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-14 13:45 EDT by Damian Lydek CLA
Modified: 2022-06-09 10:02 EDT (History)
0 users

See Also:


Attachments
Maven project reproducing the issue (7.31 KB, application/x-zip-compressed)
2020-05-14 13:45 EDT, Damian Lydek CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Damian Lydek CLA 2020-05-14 13:45:02 EDT
Created attachment 282859 [details]
Maven project reproducing the issue

Scenario:

Entity A: exists in DB, not currently in L2 cache
Entity B: new entity being created, has association to entity A but at the start of the transaction, it only has the Id of entity A (detached status). Also - some of the attributes of entity A object linked to the entity B may be dirty.


Issue:

After an existence check for entity A (as expected) entity B is persisted correctly.  Unfortunately the entity A object (from the association) appears to be directly placed into L2 cache as-is (including any dirty state it brought along).  Subsequent em.find() reveals it.


Expected result:

I would expect the detached copy of entity B to NOT be put in L2 cache simply following the existence check.  The last em.find() should find that the object is not in the PU cache and go to the database.


Reproduction:

See attached reproduction tested in 2.7.6 (version not available in dropdown in Bugzilla).  mvn test should pass but it will fail.
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:02:42 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink