define JPA CascadeType
This commit is contained in:
parent
b1945db130
commit
7d895c049e
@ -6,6 +6,7 @@ import static javax.persistence.GenerationType.SEQUENCE;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
@ -67,7 +68,7 @@ public class Domain extends AbstractEntity {
|
|||||||
@Column(name = "domain_dns_master", columnDefinition = "character varying(64)")
|
@Column(name = "domain_dns_master", columnDefinition = "character varying(64)")
|
||||||
private String dnsMaster;
|
private String dnsMaster;
|
||||||
|
|
||||||
@ManyToMany(fetch=FetchType.EAGER, mappedBy="domains")
|
@ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="domains")
|
||||||
private Set<DomainOption> domainOptions;
|
private Set<DomainOption> domainOptions;
|
||||||
|
|
||||||
public Domain() {
|
public Domain() {
|
||||||
|
@ -4,6 +4,7 @@ import static javax.persistence.GenerationType.SEQUENCE;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
@ -34,7 +35,7 @@ public class DomainOption extends AbstractEntity {
|
|||||||
@Column(name = "domain_option_name", columnDefinition = "character varying(256)", nullable = false)
|
@Column(name = "domain_option_name", columnDefinition = "character varying(256)", nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ManyToMany(fetch=FetchType.LAZY)
|
@ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.LAZY)
|
||||||
@JoinTable(name="domain__domain_option",
|
@JoinTable(name="domain__domain_option",
|
||||||
joinColumns={@JoinColumn(name="domain_option_id", referencedColumnName="domain_option_id")},
|
joinColumns={@JoinColumn(name="domain_option_id", referencedColumnName="domain_option_id")},
|
||||||
inverseJoinColumns={@JoinColumn(name="domain_id", referencedColumnName="domain_id")})
|
inverseJoinColumns={@JoinColumn(name="domain_id", referencedColumnName="domain_id")})
|
||||||
|
Loading…
Reference in New Issue
Block a user