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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
package com.src.jpa;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name = "affectation", catalog = "datagta", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Affectation.findAll", query = "SELECT a FROM Affectation a"),
@NamedQuery(name = "Affectation.findByMat", query = "SELECT a FROM Affectation a WHERE a.affectationPK.mat = :mat"),
@NamedQuery(name = "Affectation.findByNumDmd", query = "SELECT a FROM Affectation a WHERE a.affectationPK.numDmd = :numDmd"),
@NamedQuery(name = "Affectation.findByDateAffectation", query = "SELECT a FROM Affectation a WHERE a.dateAffectation = :dateAffectation")})
public class Affectation implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected AffectationPK affectationPK;
@Column(name = "date_affectation")
@Temporal(TemporalType.DATE)
private Date dateAffectation;
@JoinColumn(name = "numDmd", referencedColumnName = "numDmd", insertable = false, updatable = false)
@ManyToOne(optional = false)
private Demande demande;
public Affectation() {
}
public Affectation(AffectationPK affectationPK) {
this.affectationPK = affectationPK;
}
public Affectation(int mat, int numDmd) {
this.affectationPK = new AffectationPK(mat, numDmd);
}
public AffectationPK getAffectationPK() {
return affectationPK;
}
public void setAffectationPK(AffectationPK affectationPK) {
this.affectationPK = affectationPK;
}
public Date getDateAffectation() {
return dateAffectation;
}
public void setDateAffectation(Date dateAffectation) {
this.dateAffectation = dateAffectation;
}
public Demande getDemande() {
return demande;
}
public void setDemande(Demande demande) {
this.demande = demande;
}
@Override
public int hashCode() {
int hash = 0;
hash += (affectationPK != null ? affectationPK.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Affectation)) {
return false;
}
Affectation other = (Affectation) object;
if ((this.affectationPK == null && other.affectationPK != null) || (this.affectationPK != null && !this.affectationPK.equals(other.affectationPK))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.src.jpa.Affectation[ affectationPK=" + affectationPK + " ]";
}
} |
Partager