Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.javaxia.business.entities;
- import java.io.Serializable;
- import java.util.Collection;
- import java.util.Date;
- import javax.persistence.Basic;
- import javax.persistence.CascadeType;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.GenerationType;
- import javax.persistence.Id;
- import javax.persistence.JoinColumn;
- import javax.persistence.Lob;
- import javax.persistence.ManyToOne;
- import javax.persistence.NamedQueries;
- import javax.persistence.NamedQuery;
- import javax.persistence.OneToMany;
- import javax.persistence.Table;
- import javax.persistence.Temporal;
- import javax.persistence.TemporalType;
- import javax.validation.constraints.NotNull;
- import javax.validation.constraints.Size;
- import javax.xml.bind.annotation.XmlRootElement;
- import javax.xml.bind.annotation.XmlTransient;
- /**
- *
- * @author Cristallix
- */
- @Entity
- @Table(name = "livre")
- @XmlRootElement
- @NamedQueries({
- @NamedQuery(name = "Livre.findAll", query = "SELECT l FROM Livre l"),
- @NamedQuery(name = "Livre.findByIdLivre", query = "SELECT l FROM Livre l WHERE l.idLivre = :idLivre"),
- @NamedQuery(name = "Livre.findByParution", query = "SELECT l FROM Livre l WHERE l.parution = :parution"),
- @NamedQuery(name = "Livre.findByPrix", query = "SELECT l FROM Livre l WHERE l.prix = :prix"),
- @NamedQuery(name = "Livre.findByStock", query = "SELECT l FROM Livre l WHERE l.stock = :stock"),
- @NamedQuery(name = "Livre.findBySeuil", query = "SELECT l FROM Livre l WHERE l.seuil = :seuil")})
- public class Livre implements Serializable {
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Basic(optional = false)
- @NotNull
- @Column(name = "ID_LIVRE")
- private Integer idLivre;
- @Basic(optional = false)
- @NotNull
- @Lob
- @Size(min = 1, max = 65535)
- @Column(name = "NOM")
- private String nom;
- @Basic(optional = false)
- @NotNull
- @Lob
- @Size(min = 1, max = 65535)
- @Column(name = "EDITEUR")
- private String editeur;
- @Basic(optional = false)
- @NotNull
- @Lob
- @Size(min = 1, max = 65535)
- @Column(name = "AUTEUR")
- private String auteur;
- @Basic(optional = false)
- @NotNull
- @Lob
- @Size(min = 1, max = 65535)
- @Column(name = "RESUME")
- private String resume;
- @Basic(optional = false)
- @NotNull
- @Column(name = "PARUTION")
- @Temporal(TemporalType.DATE)
- private Date parution;
- @Basic(optional = false)
- @NotNull
- @Column(name = "PRIX")
- private float prix;
- @Basic(optional = false)
- @NotNull
- @Column(name = "STOCK")
- private int stock;
- @Basic(optional = false)
- @NotNull
- @Column(name = "SEUIL")
- private int seuil;
- @Basic(optional = false)
- @NotNull
- @Lob
- @Size(min = 1, max = 65535)
- @Column(name = "ETAT_LIVRE")
- private String etatLivre;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "livre")
- private Collection<Contenir> contenirCollection;
- @JoinColumn(name = "ID_CAT", referencedColumnName = "ID_CAT")
- @ManyToOne(optional = false)
- private Categorie idCat;
- public Livre() {
- }
- public Livre(Integer idLivre) {
- this.idLivre = idLivre;
- }
- public Livre(Integer idLivre, String nom, String editeur, String auteur, String resume, Date parution, float prix, int stock, int seuil, String etatLivre) {
- this.idLivre = idLivre;
- this.nom = nom;
- this.editeur = editeur;
- this.auteur = auteur;
- this.resume = resume;
- this.parution = parution;
- this.prix = prix;
- this.stock = stock;
- this.seuil = seuil;
- this.etatLivre = etatLivre;
- }
- public Integer getIdLivre() {
- return idLivre;
- }
- public void setIdLivre(Integer idLivre) {
- this.idLivre = idLivre;
- }
- public String getNom() {
- return nom;
- }
- public void setNom(String nom) {
- this.nom = nom;
- }
- public String getEditeur() {
- return editeur;
- }
- public void setEditeur(String editeur) {
- this.editeur = editeur;
- }
- public String getAuteur() {
- return auteur;
- }
- public void setAuteur(String auteur) {
- this.auteur = auteur;
- }
- public String getResume() {
- return resume;
- }
- public void setResume(String resume) {
- this.resume = resume;
- }
- public Date getParution() {
- return parution;
- }
- public void setParution(Date parution) {
- this.parution = parution;
- }
- public float getPrix() {
- return prix;
- }
- public void setPrix(float prix) {
- this.prix = prix;
- }
- public int getStock() {
- return stock;
- }
- public void setStock(int stock) {
- this.stock = stock;
- }
- public int getSeuil() {
- return seuil;
- }
- public void setSeuil(int seuil) {
- this.seuil = seuil;
- }
- public String getEtatLivre() {
- return etatLivre;
- }
- public void setEtatLivre(String etatLivre) {
- this.etatLivre = etatLivre;
- }
- @XmlTransient
- public Collection<Contenir> getContenirCollection() {
- return contenirCollection;
- }
- public void setContenirCollection(Collection<Contenir> contenirCollection) {
- this.contenirCollection = contenirCollection;
- }
- public Categorie getIdCat() {
- return idCat;
- }
- public void setIdCat(Categorie idCat) {
- this.idCat = idCat;
- }
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (idLivre != null ? idLivre.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 Livre)) {
- return false;
- }
- Livre other = (Livre) object;
- if ((this.idLivre == null && other.idLivre != null) || (this.idLivre != null && !this.idLivre.equals(other.idLivre))) {
- return false;
- }
- return true;
- }
- @Override
- public String toString() {
- return "com.javaxia.entities.Livre[ idLivre=" + idLivre + " ]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment