Bug 548627 - New Object created and deleted in nested UnitOfWork is commited to DB
Summary: New Object created and deleted in nested UnitOfWork is commited to DB
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 critical with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-25 08:25 EDT by thorsten kruse CLA
Modified: 2022-06-09 10:08 EDT (History)
2 users (show)

See Also:


Attachments
Reproducer (20.09 KB, application/x-zip-compressed)
2019-09-24 14:16 EDT, Ravi Babu Tummuru CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description thorsten kruse CLA 2019-06-25 08:25:42 EDT
When creating a new object, deleting it and an object in relation within an nested context, commits the new object to DB.

1) Create a new UnitOfWork
2) Read an Employee Bob and his adresses.
3) Create and register a new adress for Bob.
4) Start a nested UnitOfWork and register Bob
5) Delete all Adresses and Bob
6) commit nested UnitOfWork
6.1) Stop here for debugging
7) commit UnitOfWork

At 6.1) you can see no adresses at nested Bob, but still all adresses at Bob. After 7) you see an INSERT statement for the new adress and DELETEs for the other adresses and Bob. Looking to DB tables shows the result of the statements. Status of DB tables differs completely to status of Entities. Both status are wrong.

DB constraint fails for Adress.employee as the field points to a non existing Employee (just deleted).

see https://www.eclipse.org/forums/index.php/t/1099446/
Comment 1 Ravi Babu Tummuru CLA 2019-09-24 14:16:18 EDT
Created attachment 280004 [details]
Reproducer
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:08:38 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink