0
@Entity
@Table(name = "artist")
public class Artist implements java.io.Serializable{
@Basic
@Column(name = "is_active",nullable=false)
private Boolean isActive = false;
@OneToMany(mappedBy = "artist", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
private Set<Project> projects= new HashSet<Project>();
}
@Entity
@Table(name = "project")
public class Project implements java.io.Serializable{
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "artist_id")
private Artist artist;
@Basic
@Column(name = "is_active",nullable=false)
private Boolean isActive = false;
}
我可以初始化在Project
isActive
就像爲了證明Project
國旗
private Boolean isActive = ((getArtist()!=null)? getArtist().getIsActive(): false);
的標誌得到由Artist
初始化「以下在Project
中定義成員的順序是否會導致isActive
始終爲假?