@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>();
}
and
@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;
}
Can I initialize isActive
in Project
like following with the intent that Project
's flag gets initialized by Artist
's flag
private Boolean isActive = ((getArtist()!=null)? getArtist().getIsActive(): false);
Will the order in which the members are defined in Project
can cause isActive
to be false always?