Skip to content

Commit

Permalink
[jakartaee/persistence#632] Don't assume persist cascading for associ…
Browse files Browse the repository at this point in the history
…ations part of the id
  • Loading branch information
beikov committed May 21, 2024
1 parent d78d8ae commit 700c6c0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public void persistMX1Test1() throws Exception {
final DID1bDependent dep2 = new DID1bDependent(new DID1bDependentId("Michelle", 1L), employee1);
final DID1bDependent dep3 = new DID1bDependent(new DID1bDependentId("John", 2L), employee2);

em.persist(employee1);
em.persist(employee2);
em.persist(dep1);
em.persist(dep2);
em.persist(dep3);
em.persist(employee1);
em.persist(employee2);

logger.log(Logger.Level.TRACE, "persisted Employees and Dependents");
em.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public void DIDTest() throws Exception {
final DID1Dependent dep2 = new DID1Dependent("Michelle", employee1);
final DID1Dependent dep3 = new DID1Dependent("John", employee2);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);
getEntityManager().persist(dep1);
getEntityManager().persist(dep2);
getEntityManager().persist(dep3);
getEntityManager().persist(employee1);
getEntityManager().persist(employee2);

logger.log(Logger.Level.TRACE, "persisted Employees and Dependents");
getEntityManager().flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public void DIDTest() throws Exception {
final DID1bDependent dep2 = new DID1bDependent(depId2, employee1);
final DID1bDependent dep3 = new DID1bDependent(depId3, employee2);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);
getEntityManager().persist(dep1);
getEntityManager().persist(dep2);
getEntityManager().persist(dep3);
getEntityManager().persist(employee1);
getEntityManager().persist(employee2);

logger.log(Logger.Level.TRACE, "persisted Employees and Dependents");
getEntityManager().flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public void DIDTest() throws Exception {
final DID2bDependent dep2 = new DID2bDependent(new DID2bDependentId("Michelle", eId1), employee1);
final DID2bDependent dep3 = new DID2bDependent(new DID2bDependentId("John", eId2), employee2);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);
getEntityManager().persist(dep1);
getEntityManager().persist(dep2);
getEntityManager().persist(dep3);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);
getEntityManager().flush();
logger.log(Logger.Level.TRACE, "persisted Employees and Dependents");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ public void DIDTest() throws Exception {
final DID3Dependent dep2 = new DID3Dependent(depId2, employee1);
final DID3Dependent dep3 = new DID3Dependent(depId3, employee2);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);
getEntityManager().persist(dep1);
getEntityManager().persist(dep2);
getEntityManager().persist(dep3);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);

getEntityManager().flush();
logger.log(Logger.Level.TRACE, "persisted Employees and Dependents");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,12 @@ public void DIDTest() throws Exception {
final DID3bDependent dep2 = new DID3bDependent(depId2, employee1);
final DID3bDependent dep3 = new DID3bDependent(depId3, employee2);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);
getEntityManager().persist(dep1);
getEntityManager().persist(dep2);
getEntityManager().persist(dep3);

getEntityManager().persist(employee1);
getEntityManager().persist(employee2);

logger.log(Logger.Level.TRACE, "persisted Employees and Dependents");
getEntityManager().flush();

Expand Down

0 comments on commit 700c6c0

Please sign in to comment.