Advertisement
arthurgregorio

ClasseGrupo

Nov 18th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.99 KB | None | 0 0
  1. package jb.model.bean;
  2.  
  3. import mage.utils.SQLClock;
  4.  
  5. import java.util.List;
  6. import java.util.Date;
  7. import java.util.ArrayList;
  8. import java.io.Serializable;
  9. import javax.persistence.Id;
  10. import javax.persistence.Table;
  11. import javax.persistence.Column;
  12. import javax.persistence.Entity;
  13. import javax.persistence.Temporal;
  14. import javax.persistence.FetchType;
  15. import javax.persistence.OneToMany;
  16. import javax.persistence.TemporalType;
  17. import javax.persistence.GeneratedValue;
  18. import javax.persistence.GenerationType;
  19. import org.hibernate.annotations.Cascade;
  20. import org.hibernate.annotations.CascadeType;
  21. import javax.xml.bind.annotation.XmlRootElement;
  22.  
  23. /**
  24.  *
  25.  * @author Arthur Gregorio
  26.  *
  27.  * @since 1.0
  28.  * @version 1.0, 03/11/2011
  29.  */
  30. @Entity
  31. @XmlRootElement
  32. @Table(name="grupo_produto")
  33. public class GrupoProduto implements Serializable {
  34.  
  35.     @Id
  36.     @GeneratedValue(strategy= GenerationType.IDENTITY)
  37.     @Column(name="grupo_id", unique=true, nullable=false)
  38.     private int id;
  39.     @Column(name="nome", length=90, nullable=false)
  40.     private String nome;
  41.    
  42.     @Temporal(TemporalType.TIMESTAMP)
  43.     @Column(name="data_inclusao", nullable=false)
  44.     private Date dataInclusao;
  45.     @Column(name="incluido_por", length=45, nullable=false)
  46.     private String incluidoPor;
  47.  
  48.     @OneToMany(mappedBy="grupo", fetch=FetchType.LAZY)
  49.     @Cascade(CascadeType.ALL)
  50.     private List<SubgrupoProduto> subgrupos;
  51.    
  52.     public GrupoProduto() {
  53.        
  54.         this.id = 0;
  55.         this.nome = null;
  56.         this.dataInclusao = SQLClock.getTimestamp();
  57.         this.incluidoPor = null;
  58.         this.subgrupos = new ArrayList<SubgrupoProduto>();
  59.     }
  60.  
  61.     /**
  62.      * @return the id
  63.      */
  64.     public int getId() {
  65.         return id;
  66.     }
  67.  
  68.     /**
  69.      * @param id the id to set
  70.      */
  71.     public void setId(int id) {
  72.         this.id = id;
  73.     }
  74.  
  75.     /**
  76.      * @return the nome
  77.      */
  78.     public String getNome() {
  79.         return nome;
  80.     }
  81.  
  82.     /**
  83.      * @param nome the nome to set
  84.      */
  85.     public void setNome(String nome) {
  86.         this.nome = nome;
  87.     }
  88.  
  89.     /**
  90.      * @return the dataInclusao
  91.      */
  92.     public Date getDataInclusao() {
  93.         return dataInclusao;
  94.     }
  95.  
  96.     /**
  97.      * @param dataInclusao the dataInclusao to set
  98.      */
  99.     public void setDataInclusao(Date dataInclusao) {
  100.         this.dataInclusao = dataInclusao;
  101.     }
  102.  
  103.     /**
  104.      * @return the incluidoPor
  105.      */
  106.     public String getIncluidoPor() {
  107.         return incluidoPor;
  108.     }
  109.  
  110.     /**
  111.      * @param incluidoPor the incluidoPor to set
  112.      */
  113.     public void setIncluidoPor(String incluidoPor) {
  114.         this.incluidoPor = incluidoPor;
  115.     }
  116.  
  117.     /**
  118.      * @return the subgrupos
  119.      */
  120.     public List<SubgrupoProduto> getSubgrupos() {
  121.         return subgrupos;
  122.     }
  123.  
  124.     /**
  125.      * @param subgrupos the subgrupos to set
  126.      */
  127.     public void setSubgrupos(List<SubgrupoProduto> subgrupos) {
  128.         this.subgrupos = subgrupos;
  129.     }
  130. }
  131.  
  132.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement