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 101 102 103 104 105 106 107 108 109 110 111 112 113
| /*
* Region.java
*
* Created on 17 juillet 2007, 10:40
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.entity;
import java.io.Serializable;
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;
@Entity
@Table(name = "region")
@NamedQueries( {
@NamedQuery(name = "Region.findByRegid", query = "SELECT r FROM Region r WHERE r.regionPK.regid = :regid"),
@NamedQuery(name = "Region.findByRegnom", query = "SELECT r FROM Region r WHERE r.regnom = :regnom"),
@NamedQuery(name = "Region.findByZneid", query = "SELECT r FROM Region r WHERE r.regionPK.zneid = :zneid"),
@NamedQuery(name = "Region.findAllregion", query = "SELECT r FROM Region r ORDER BY r.regionPK.regid")
})
public class Region implements Serializable {
/**
* EmbeddedId primary key field
*/
@EmbeddedId
protected RegionPK regionPK;
@Column(name = "Reg_nom")
private String regnom;
@JoinColumn(name = "Zne_id", referencedColumnName = "Zne_id", insertable = false, updatable = false)
@ManyToOne
private Zone zone;
/** Creates a new instance of Region */
public Region() {
}
public Region(RegionPK regionPK) {
this.regionPK = regionPK;
}
public Region(int zneid, int regid) {
this.regionPK = new RegionPK(zneid, regid);
}
public RegionPK getRegionPK() {
return this.regionPK;
}
public void setRegionPK(RegionPK regionPK) {
this.regionPK = regionPK;
}
public String getRegnom() {
return this.regnom;
}
public void setRegnom(String regnom) {
this.regnom = regnom;
}
public Zone getZone() {
return this.zone;
}
public void setZone(Zone zone) {
this.zone = zone;
}
@Override
public int hashCode() {
int hash = 0;
hash += (this.regionPK != null ? this.regionPK.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 Region)) {
return false;
}
Region other = (Region)object;
if (this.regionPK != other.regionPK && (this.regionPK == null || !this.regionPK.equals(other.regionPK))) return false;
return true;
}
@Override
public String toString() {
return "com.entity.Region[regionPK=" + regionPK + "]";
}
} |
Partager