Advertisement
arthurgregorio

ClasseSubgrupo

Nov 18th, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.50 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.io.Serializable;
  8. import java.util.ArrayList;
  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.OneToMany;
  15. import javax.persistence.FetchType;
  16. import javax.persistence.ManyToOne;
  17. import javax.persistence.JoinColumn;
  18. import javax.persistence.TemporalType;
  19. import javax.persistence.GeneratedValue;
  20. import javax.persistence.GenerationType;
  21. import org.hibernate.annotations.Cascade;
  22. import org.hibernate.annotations.CascadeType;
  23. import javax.xml.bind.annotation.XmlRootElement;
  24.  
  25. /**
  26.  *
  27.  * @author Arthur Gregorio
  28.  *
  29.  * @since 1.0
  30.  * @version 1.0, 03/11/2011
  31.  */
  32. @Entity
  33. @XmlRootElement
  34. @Table(name="subgrupo_produto")
  35. public class SubgrupoProduto implements Serializable {
  36.  
  37.     @Id
  38.     @GeneratedValue(strategy= GenerationType.IDENTITY)
  39.     @Column(name="subgrupo_id", unique=true, nullable=false)
  40.     private int id;
  41.     @Column(name="nome", length=90, nullable=false)
  42.     private String nome;
  43.    
  44.     @Temporal(TemporalType.TIMESTAMP)
  45.     @Column(name="data_inclusao", nullable=false)
  46.     private Date dataInclusao;
  47.     @Column(name="incluido_por", length=45, nullable=false)
  48.     private String incluidoPor;
  49.    
  50.     @ManyToOne(fetch=FetchType.EAGER)
  51.     @JoinColumn(name="grupo_id", insertable=true, updatable=true)
  52.     @Cascade(CascadeType.ALL)
  53.     private GrupoProduto grupo;
  54.    
  55.     @OneToMany(mappedBy="subgrupo", fetch=FetchType.LAZY)
  56.     @Cascade(CascadeType.ALL)
  57.     private List<Produto> produtos;
  58.  
  59.     public SubgrupoProduto() {
  60.        
  61.         this.id = 0;
  62.        
  63.         this.nome = null;
  64.         this.dataInclusao = SQLClock.getTimestamp();
  65.         this.incluidoPor = null;
  66.        
  67.         this.grupo = null;
  68.         this.produtos = new ArrayList<Produto>();
  69.     }
  70.  
  71.     /**
  72.      * @return the id
  73.      */
  74.     public int getId() {
  75.         return id;
  76.     }
  77.  
  78.     /**
  79.      * @param id the id to set
  80.      */
  81.     public void setId(int id) {
  82.         this.id = id;
  83.     }
  84.  
  85.     /**
  86.      * @return the nome
  87.      */
  88.     public String getNome() {
  89.         return nome;
  90.     }
  91.  
  92.     /**
  93.      * @param nome the nome to set
  94.      */
  95.     public void setNome(String nome) {
  96.         this.nome = nome;
  97.     }
  98.  
  99.     /**
  100.      * @return the dataInclusao
  101.      */
  102.     public Date getDataInclusao() {
  103.         return dataInclusao;
  104.     }
  105.  
  106.     /**
  107.      * @param dataInclusao the dataInclusao to set
  108.      */
  109.     public void setDataInclusao(Date dataInclusao) {
  110.         this.dataInclusao = dataInclusao;
  111.     }
  112.  
  113.     /**
  114.      * @return the incluidoPor
  115.      */
  116.     public String getIncluidoPor() {
  117.         return incluidoPor;
  118.     }
  119.  
  120.     /**
  121.      * @param incluidoPor the incluidoPor to set
  122.      */
  123.     public void setIncluidoPor(String incluidoPor) {
  124.         this.incluidoPor = incluidoPor;
  125.     }
  126.  
  127.     /**
  128.      * @return the grupo
  129.      */
  130.     public GrupoProduto getGrupo() {
  131.         return grupo;
  132.     }
  133.  
  134.     /**
  135.      * @param grupo the grupo to set
  136.      */
  137.     public void setGrupo(GrupoProduto grupo) {
  138.         this.grupo = grupo;
  139.     }
  140.  
  141.     /**
  142.      * @return the produtos
  143.      */
  144.     public List<Produto> getProdutos() {
  145.         return produtos;
  146.     }
  147.  
  148.     /**
  149.      * @param produtos the produtos to set
  150.      */
  151.     public void setProdutos(List<Produto> produtos) {
  152.         this.produtos = produtos;
  153.     }
  154. }
  155.  
  156.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement