#2377 - Wrong order in batch save, fix transaction depth

The guts of this fix is in DefaultPersister.saveAssocOne() with the change to use the new transaction.depthDecrement() method. For our failing test cases this changes the depth from -1, 0 to be 0, 1.

We can see the impact of this change in the batch ordering via the logging of:
 io.ebean.SUM - txn[1001] BatchControl flush ...
This commit is contained in:
rbygrave committed 2021-09-17 17:58:20 +12:00
1 parent b38a21f8c4
commit f51f2269fb
10 files changed
+134 -59

No files matched your search

@@ -1,12 +1,14 @@
package org.tests.model.basic.relates;
import java.util.UUID;
import javax.persistence.*;
import io.ebean.annotation.ChangeLog;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.util.UUID;
/**
* Relation entity
*/
@@ -23,6 +25,9 @@ public class Relation2 {
this.name = name;
}
@ManyToOne
private Relation4 r4NoCascade;
@ManyToOne
private Relation3 noCascade;
@@ -60,5 +65,12 @@ public class Relation2 {
public void setWithCascade(Relation3 withCascade) {
this.withCascade = withCascade;
}
public Relation4 getR4NoCascade() {
return r4NoCascade;
}
public void setR4NoCascade(Relation4 r4NoCascade) {
this.r4NoCascade = r4NoCascade;
}
}
@@ -0,0 +1,42 @@
package org.tests.model.basic.relates;
import io.ebean.annotation.ChangeLog;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.UUID;
/**
* Relation entity
*/
@Entity
@ChangeLog
public class Relation4 {
@Id
private UUID id = UUID.randomUUID();
private String name;
public Relation4(String name) {
this.name = name;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}