sdmx.gateway.entities.Language Maven / Gradle / Ivy
The newest version!
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sdmx.gateway.entities;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author james
*/
@Entity
@Table(name = "language")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Language.findAll", query = "SELECT l FROM Language l"),
@NamedQuery(name = "Language.findByLang", query = "SELECT l FROM Language l WHERE l.lang = :lang"),
@NamedQuery(name = "Language.findByName", query = "SELECT l FROM Language l WHERE l.name = :name")})
public class Language implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 255)
@Column(name = "lang")
private String lang;
@Size(max = 255)
@Column(name = "name")
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "language")
private List nametextList;
public Language() {
}
public Language(String lang) {
this.lang = lang;
}
public String getLang() {
return lang;
}
public void setLang(String lang) {
this.lang = lang;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlTransient
public List getNametextList() {
return nametextList;
}
public void setNametextList(List nametextList) {
this.nametextList = nametextList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (lang != null ? lang.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 Language)) {
return false;
}
Language other = (Language) object;
if ((this.lang == null && other.lang != null) || (this.lang != null && !this.lang.equals(other.lang))) {
return false;
}
return true;
}
@Override
public String toString() {
return "sdmx.gateway.entities.Language[ lang=" + lang + " ]";
}
}