1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| @Table(name = "RECEPTACLE", uniqueConstraints = { @UniqueConstraint(columnNames = { "NESTING" }) })
@NamedQueries( { @NamedQuery(name = "allReceptacleQuery", query = "FROM PersistentReceptacleImpl t ORDER BY t.family.name, t.nesting") })
@Entity
public final class PersistentReceptacleImpl implements PersistentReceptacle, Serializable {
private static final long serialVersionUID = -3124465908386690459L;
@Id
@GeneratedValue
private Integer id = null;
@ManyToOne(targetEntity = PersistentReceptacleFamilyImpl.class)
@JoinColumn(name = "FAMILY_ID", nullable = false)
private PersistentReceptacleFamily family = null;
@Column(name = "NESTING", length = 50, nullable = false)
private String nesting = null;
@ManyToMany(targetEntity = PersistentReceptacleImpl.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "RECEPTACLE_ASSOCIATION", joinColumns = @JoinColumn(name = "RECEPTACLE_ID"), inverseJoinColumns = @JoinColumn(name = "ASSOCIATED_RECEPTACLE_ID"))
private Collection<PersistentReceptacle> associations;
public PersistentReceptacleImpl() {
super();
}
public Integer getId() {
return this.id;
}
public PersistentReceptacleFamily getFamily() {
return this.family;
}
public void setFamily(final PersistentReceptacleFamily family) {
this.family = family;
}
public String getNesting() {
return this.nesting;
}
public void setNesting(final String nesting) {
this.nesting = nesting;
}
public Collection<PersistentReceptacle> getAssociations() {
if (this.associations == null) {
this.associations = new LinkedHashSet<PersistentReceptacle>();
}
return this.associations;
}
@Override
public boolean equals(final Object obj) {
boolean result = false;
if (obj == this) {
result = true;
} else if ((this.nesting != null) && (obj instanceof PersistentReceptacleImpl)) {
result = this.nesting.equals(((PersistentReceptacleImpl) obj).nesting);
}
return result;
}
@Override
public int hashCode() {
int result = 0;
if (this.nesting != null) {
result = this.nesting.hashCode();
}
return result;
}
@Override
public String toString() {
return "PersistentReceptacle[" + this.nesting + "]";
}
} |
Partager