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 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.Lob;
- 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 Cristallix
- */
- @Entity
- @Table(name = "categorie")
- @XmlRootElement
- @NamedQueries({
- @NamedQuery(name = "Categorie.findAll", query = "SELECT c FROM Categorie c"),
- @NamedQuery(name = "Categorie.findByIdCat", query = "SELECT c FROM Categorie c WHERE c.idCat = :idCat")})
- public class Categorie implements Serializable {
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Basic(optional = false)
- @NotNull
- @Column(name = "ID_CAT")
- private Integer idCat;
- @Basic(optional = false)
- @NotNull
- @Lob
- @Size(min = 1, max = 65535)
- @Column(name = "NOM_CAT")
- private String nomCat;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCat")
- private Collection<Livre> livreCollection;
- public Categorie() {
- }
- public Categorie(Integer idCat) {
- this.idCat = idCat;
- }
- public Categorie(Integer idCat, String nomCat) {
- this.idCat = idCat;
- this.nomCat = nomCat;
- }
- public Integer getIdCat() {
- return idCat;
- }
- public void setIdCat(Integer idCat) {
- this.idCat = idCat;
- }
- public String getNomCat() {
- return nomCat;
- }
- public void setNomCat(String nomCat) {
- this.nomCat = nomCat;
- }
- @XmlTransient
- public Collection<Livre> getLivreCollection() {
- return livreCollection;
- }
- public void setLivreCollection(Collection<Livre> livreCollection) {
- this.livreCollection = livreCollection;
- }
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (idCat != null ? idCat.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 Categorie)) {
- return false;
- }
- Categorie other = (Categorie) object;
- if ((this.idCat == null && other.idCat != null) || (this.idCat != null && !this.idCat.equals(other.idCat))) {
- return false;
- }
- return true;
- }
- @Override
- public String toString() {
- return "com.javaxia.entities.Categorie[ idCat=" + idCat + " ]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment