Guest User

Livre.entity

a guest
Dec 9th, 2011
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.48 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package com.javaxia.business.entities;
  6.  
  7. import java.io.Serializable;
  8. import java.util.Collection;
  9. import java.util.Date;
  10. import javax.persistence.Basic;
  11. import javax.persistence.CascadeType;
  12. import javax.persistence.Column;
  13. import javax.persistence.Entity;
  14. import javax.persistence.GeneratedValue;
  15. import javax.persistence.GenerationType;
  16. import javax.persistence.Id;
  17. import javax.persistence.JoinColumn;
  18. import javax.persistence.Lob;
  19. import javax.persistence.ManyToOne;
  20. import javax.persistence.NamedQueries;
  21. import javax.persistence.NamedQuery;
  22. import javax.persistence.OneToMany;
  23. import javax.persistence.Table;
  24. import javax.persistence.Temporal;
  25. import javax.persistence.TemporalType;
  26. import javax.validation.constraints.NotNull;
  27. import javax.validation.constraints.Size;
  28. import javax.xml.bind.annotation.XmlRootElement;
  29. import javax.xml.bind.annotation.XmlTransient;
  30.  
  31. /**
  32.  *
  33.  * @author Cristallix
  34.  */
  35. @Entity
  36. @Table(name = "livre")
  37. @XmlRootElement
  38. @NamedQueries({
  39.     @NamedQuery(name = "Livre.findAll", query = "SELECT l FROM Livre l"),
  40.     @NamedQuery(name = "Livre.findByIdLivre", query = "SELECT l FROM Livre l WHERE l.idLivre = :idLivre"),
  41.     @NamedQuery(name = "Livre.findByParution", query = "SELECT l FROM Livre l WHERE l.parution = :parution"),
  42.     @NamedQuery(name = "Livre.findByPrix", query = "SELECT l FROM Livre l WHERE l.prix = :prix"),
  43.     @NamedQuery(name = "Livre.findByStock", query = "SELECT l FROM Livre l WHERE l.stock = :stock"),
  44.     @NamedQuery(name = "Livre.findBySeuil", query = "SELECT l FROM Livre l WHERE l.seuil = :seuil")})
  45. public class Livre implements Serializable {
  46.     private static final long serialVersionUID = 1L;
  47.     @Id
  48.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  49.     @Basic(optional = false)
  50.     @NotNull
  51.     @Column(name = "ID_LIVRE")
  52.     private Integer idLivre;
  53.     @Basic(optional = false)
  54.     @NotNull
  55.     @Lob
  56.     @Size(min = 1, max = 65535)
  57.     @Column(name = "NOM")
  58.     private String nom;
  59.     @Basic(optional = false)
  60.     @NotNull
  61.     @Lob
  62.     @Size(min = 1, max = 65535)
  63.     @Column(name = "EDITEUR")
  64.     private String editeur;
  65.     @Basic(optional = false)
  66.     @NotNull
  67.     @Lob
  68.     @Size(min = 1, max = 65535)
  69.     @Column(name = "AUTEUR")
  70.     private String auteur;
  71.     @Basic(optional = false)
  72.     @NotNull
  73.     @Lob
  74.     @Size(min = 1, max = 65535)
  75.     @Column(name = "RESUME")
  76.     private String resume;
  77.     @Basic(optional = false)
  78.     @NotNull
  79.     @Column(name = "PARUTION")
  80.     @Temporal(TemporalType.DATE)
  81.     private Date parution;
  82.     @Basic(optional = false)
  83.     @NotNull
  84.     @Column(name = "PRIX")
  85.     private float prix;
  86.     @Basic(optional = false)
  87.     @NotNull
  88.     @Column(name = "STOCK")
  89.     private int stock;
  90.     @Basic(optional = false)
  91.     @NotNull
  92.     @Column(name = "SEUIL")
  93.     private int seuil;
  94.     @Basic(optional = false)
  95.     @NotNull
  96.     @Lob
  97.     @Size(min = 1, max = 65535)
  98.     @Column(name = "ETAT_LIVRE")
  99.     private String etatLivre;
  100.     @OneToMany(cascade = CascadeType.ALL, mappedBy = "livre")
  101.     private Collection<Contenir> contenirCollection;
  102.     @JoinColumn(name = "ID_CAT", referencedColumnName = "ID_CAT")
  103.     @ManyToOne(optional = false)
  104.     private Categorie idCat;
  105.  
  106.     public Livre() {
  107.     }
  108.  
  109.     public Livre(Integer idLivre) {
  110.         this.idLivre = idLivre;
  111.     }
  112.  
  113.     public Livre(Integer idLivre, String nom, String editeur, String auteur, String resume, Date parution, float prix, int stock, int seuil, String etatLivre) {
  114.         this.idLivre = idLivre;
  115.         this.nom = nom;
  116.         this.editeur = editeur;
  117.         this.auteur = auteur;
  118.         this.resume = resume;
  119.         this.parution = parution;
  120.         this.prix = prix;
  121.         this.stock = stock;
  122.         this.seuil = seuil;
  123.         this.etatLivre = etatLivre;
  124.     }
  125.  
  126.     public Integer getIdLivre() {
  127.         return idLivre;
  128.     }
  129.  
  130.     public void setIdLivre(Integer idLivre) {
  131.         this.idLivre = idLivre;
  132.     }
  133.  
  134.     public String getNom() {
  135.         return nom;
  136.     }
  137.  
  138.     public void setNom(String nom) {
  139.         this.nom = nom;
  140.     }
  141.  
  142.     public String getEditeur() {
  143.         return editeur;
  144.     }
  145.  
  146.     public void setEditeur(String editeur) {
  147.         this.editeur = editeur;
  148.     }
  149.  
  150.     public String getAuteur() {
  151.         return auteur;
  152.     }
  153.  
  154.     public void setAuteur(String auteur) {
  155.         this.auteur = auteur;
  156.     }
  157.  
  158.     public String getResume() {
  159.         return resume;
  160.     }
  161.  
  162.     public void setResume(String resume) {
  163.         this.resume = resume;
  164.     }
  165.  
  166.     public Date getParution() {
  167.         return parution;
  168.     }
  169.  
  170.     public void setParution(Date parution) {
  171.         this.parution = parution;
  172.     }
  173.  
  174.     public float getPrix() {
  175.         return prix;
  176.     }
  177.  
  178.     public void setPrix(float prix) {
  179.         this.prix = prix;
  180.     }
  181.  
  182.     public int getStock() {
  183.         return stock;
  184.     }
  185.  
  186.     public void setStock(int stock) {
  187.         this.stock = stock;
  188.     }
  189.  
  190.     public int getSeuil() {
  191.         return seuil;
  192.     }
  193.  
  194.     public void setSeuil(int seuil) {
  195.         this.seuil = seuil;
  196.     }
  197.  
  198.     public String getEtatLivre() {
  199.         return etatLivre;
  200.     }
  201.  
  202.     public void setEtatLivre(String etatLivre) {
  203.         this.etatLivre = etatLivre;
  204.     }
  205.  
  206.     @XmlTransient
  207.     public Collection<Contenir> getContenirCollection() {
  208.         return contenirCollection;
  209.     }
  210.  
  211.     public void setContenirCollection(Collection<Contenir> contenirCollection) {
  212.         this.contenirCollection = contenirCollection;
  213.     }
  214.  
  215.     public Categorie getIdCat() {
  216.         return idCat;
  217.     }
  218.  
  219.     public void setIdCat(Categorie idCat) {
  220.         this.idCat = idCat;
  221.     }
  222.  
  223.     @Override
  224.     public int hashCode() {
  225.         int hash = 0;
  226.         hash += (idLivre != null ? idLivre.hashCode() : 0);
  227.         return hash;
  228.     }
  229.  
  230.     @Override
  231.     public boolean equals(Object object) {
  232.         // TODO: Warning - this method won't work in the case the id fields are not set
  233.         if (!(object instanceof Livre)) {
  234.             return false;
  235.         }
  236.         Livre other = (Livre) object;
  237.         if ((this.idLivre == null && other.idLivre != null) || (this.idLivre != null && !this.idLivre.equals(other.idLivre))) {
  238.             return false;
  239.         }
  240.         return true;
  241.     }
  242.  
  243.     @Override
  244.     public String toString() {
  245.         return "com.javaxia.entities.Livre[ idLivre=" + idLivre + " ]";
  246.     }
  247.    
  248. }
  249.  
  250.  
Advertisement
Add Comment
Please, Sign In to add comment