import java.util.HashSet;
import java.util.Set;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
@Access(AccessType.FIELD)
@Table(name = "PCY_M_PARENT_CHILD_CD")
public class ParentChildCd {
@Id
@Column(name = "CODE", nullable = false, length = 50)
@Size(max = 50)
private String code;
public String getCode() {
return code;
}
public void setCode(String __value) { this.code = __value;
}
@Column(name = "ACTIVE", nullable = false)
@NotNull
private boolean active;
public boolean isActive() {
return active;
}
public void setActive(boolean __value) { this.active = __value;
}
@Column(name = "PARENT", nullable = true)
private String parent;
public String getParent() {
return parent;
}
public void setParent(String __value) {
this.parent = __value;
}
@Column(name = "code", nullable = true)
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "PCY_M_PARENT_CHILD_CD", joinColumns = { @JoinColumn(name = "PARENT", referencedColumnName = "code") })
private Set<String> children = new HashSet<String>();
public Set<String> getChildren() {
return children;
}
public void setChildren(Set<String> __value) {
this.children = __value;
}
public boolean equals(Object obj) {
return obj == this || (obj instanceof ParentChildCd && getCode() != null && getCode().equals(((ParentChildCd) obj).getCode()));
}
public int hashCode() {
if (getCode() == null)
return super.hashCode();
return getCode().hashCode();
}
}