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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
package com.open.survey.oracle;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ColumnResult;
import javax.persistence.Entity;
import javax.persistence.EntityResult;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SqlResultSetMapping;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author olivier Thiébaut
*/
@NamedQueries({
@NamedQuery(name = "EticThemesUser.findAll", query = "SELECT e FROM EticThemesUser e"),
@NamedQuery(name = "EticThemesUser.findByIdTheme", query = "SELECT e FROM EticThemesUser e WHERE e.idTheme = :idTheme"),
@NamedQuery(name = "EticThemesUser.findByLibelleTheme", query = "SELECT e FROM EticThemesUser e WHERE e.libelleTheme = :libelleTheme"),
@NamedQuery(name = "EticThemesUser.findByDegre", query = "SELECT e FROM EticThemesUser e WHERE e.degre = :degre"),
@NamedQuery(name = "EticThemesUser.findByOrdre", query = "SELECT e FROM EticThemesUser e WHERE e.ordre = :ordre"),
@NamedQuery(name = "EticThemesUser.findByActif", query = "SELECT e FROM EticThemesUser e WHERE e.actif = :actif"),
@NamedQuery(name = "EticThemesUser.findByTooltip", query = "SELECT e FROM EticThemesUser e WHERE e.tooltip = :tooltip"),})
@Entity
@Table(name = "ETIC_THEMES_USER")
@XmlRootElement
@SqlResultSetMapping(
name = "findByIdThemeCountQuestions",
entities = {@EntityResult(entityClass = EticThemesUser.class)},
columns = {@ColumnResult(name = "countQuestions")}
)
public class EticThemesUser implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@NotNull
@Column(name = "ID_THEME")
private BigDecimal idTheme;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 250)
@Column(name = "LIBELLE_THEME")
private String libelleTheme;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "DEGRE")
private String degre;
@Basic(optional = false)
@NotNull
@Column(name = "ORDRE")
private BigInteger ordre;
@Basic(optional = false)
@NotNull
@Column(name = "ACTIF")
private short actif;
@Size(max = 500)
@Column(name = "TOOLTIP")
private String tooltip;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idTheme")
private Collection<EticQuestionsUser> eticQuestionsUserCollection;
@Transient
private BigInteger countQuestions;
public EticThemesUser(BigDecimal idTheme) {
this.idTheme = idTheme;
}
public BigInteger getCountQuestions() {
this.countQuestions = BigInteger.valueOf(this.getEticQuestionsUserCollection().size());
return countQuestions;
}
public void setCountQuestions(BigInteger countQuestions) {
this.countQuestions = countQuestions;
}
public EticThemesUser() {
}
public EticThemesUser(BigDecimal idTheme, String libelleTheme, String degre, BigInteger ordre, short actif) {
this.idTheme = idTheme;
this.libelleTheme = libelleTheme;
this.degre = degre;
this.ordre = ordre;
this.actif = actif;
}
public BigDecimal getIdTheme() {
return idTheme;
}
public void setIdTheme(BigDecimal idTheme) {
this.idTheme = idTheme;
}
public String getLibelleTheme() {
return libelleTheme;
}
public void setLibelleTheme(String libelleTheme) {
this.libelleTheme = libelleTheme;
}
public String getDegre() {
return degre;
}
public void setDegre(String degre) {
this.degre = degre;
}
public BigInteger getOrdre() {
return ordre;
}
public void setOrdre(BigInteger ordre) {
this.ordre = ordre;
}
public short getActif() {
return actif;
}
public void setActif(short actif) {
this.actif = actif;
}
public String getTooltip() {
return tooltip;
}
public void setTooltip(String tooltip) {
this.tooltip = tooltip;
}
@XmlTransient
public Collection<EticQuestionsUser> getEticQuestionsUserCollection() {
return eticQuestionsUserCollection;
}
public void setEticQuestionsUserCollection(Collection<EticQuestionsUser> eticQuestionsUserCollection) {
this.eticQuestionsUserCollection = eticQuestionsUserCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idTheme != null ? idTheme.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 EticThemesUser)) {
return false;
}
EticThemesUser other = (EticThemesUser) object;
if ((this.idTheme == null && other.idTheme != null) || (this.idTheme != null && !this.idTheme.equals(other.idTheme))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.open.survey.user.EticThemesUser[ idTheme=" + idTheme + " ]";
}
} |
Partager