Removed onPersistTrigger

This commit is contained in:
Roland Praml
2022-02-02 11:11:19 +01:00
parent 090f3cddb8
commit 0f01965a7b
5 changed files with 5 additions and 150 deletions
@@ -1,44 +0,0 @@
package org.tests.o2o;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
@Entity
public class OtoLevelALazy {
@Id
private Long id;
private String name;
@OneToOne(mappedBy = "a", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
private OtoLevelBLazy b;
public OtoLevelALazy(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public OtoLevelBLazy getB() {
return b;
}
public void setB(OtoLevelBLazy b) {
this.b = b;
}
public void setName(String name) {
this.name = name;
}
}
@@ -1,76 +0,0 @@
package org.tests.o2o;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
@Entity
public class OtoLevelBLazy {
@Id
private Long id;
private String name;
@ManyToMany()
private List<OtoLevelC> c;
@OneToOne()
private OtoLevelALazy a;
@Lob
private String blb;
public OtoLevelBLazy(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public OtoLevelALazy getA() {
return a;
}
public void setA(OtoLevelALazy a) {
this.a = a;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<OtoLevelC> getC() {
return c;
}
public final void _ebean_onPersistTrigger(String trt) {
recalc();
}
protected void recalc() {
this.getBlb();
}
public String getBlb() {
return blb;
}
public void setBlb(String blb) {
this.blb = blb;
}
}
@@ -1,14 +1,13 @@
package org.tests.o2o;
import static org.assertj.core.api.Assertions.assertThat;
import io.ebean.DB;
import io.ebean.test.LoggedSql;
import org.junit.jupiter.api.Test;
import java.util.List;
import org.junit.jupiter.api.Test;
import io.ebean.DB;
import io.ebean.test.LoggedSql;
import static org.assertj.core.api.Assertions.assertThat;
public class TestOneToOneSaveWithoutChanges {
@@ -34,19 +33,4 @@ public class TestOneToOneSaveWithoutChanges {
List<String> sql = LoggedSql.stop();
assertThat(sql).hasSize(0);
}
@Test
public void testSave2LevelsLazyPersistTrigger() {
OtoLevelALazy a = new OtoLevelALazy("A");
OtoLevelBLazy b = new OtoLevelBLazy("B");
b.setA(a);
DB.save(a);
DB.save(b);
OtoLevelALazy dbA = DB.find(OtoLevelALazy.class).select("*").where().idEq(1).findList().get(0);
LoggedSql.start();
DB.save(dbA);
List<String> sql = LoggedSql.stop();
assertThat(sql).hasSize(0);
}
}