BAEL-4643: JPA CascadeType.REMOVE vs orphanRemoval
* Reformats code using the provided intelliJ-formatter.xml
This commit is contained in:
parent
06c800c526
commit
3139be9468
@ -1,11 +1,11 @@
|
||||
package com.baeldung.jpa.removal;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
public class LineItem {
|
||||
@ -25,8 +25,10 @@ public class LineItem {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
|
||||
LineItem lineItem = (LineItem) o;
|
||||
|
||||
@ -38,5 +40,6 @@ public class LineItem {
|
||||
return id != null ? id.hashCode() : 0;
|
||||
}
|
||||
|
||||
protected LineItem() {}
|
||||
protected LineItem() {
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.baeldung.jpa.removal;
|
||||
|
||||
import java.util.List;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@ -8,6 +7,7 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class OrderRequest {
|
||||
@ -34,5 +34,6 @@ public class OrderRequest {
|
||||
lineItems.remove(lineItem);
|
||||
}
|
||||
|
||||
protected OrderRequest() {}
|
||||
protected OrderRequest() {
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,6 @@ public class ShipmentInfo {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
protected ShipmentInfo() {}
|
||||
protected ShipmentInfo() {
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.baeldung.jpa.removal;
|
||||
|
||||
import java.util.List;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.Persistence;
|
||||
@ -8,9 +11,7 @@ import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import java.util.List;
|
||||
|
||||
public class CascadeTypeRemoveIntegrationTest {
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.baeldung.jpa.removal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.Persistence;
|
||||
@ -9,9 +11,8 @@ import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrphanRemovalIntegrationTest {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user