Rodrigo_Marden

Entidade Area

Jan 9th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.09 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package br.com.celg.entidade;
  6.  
  7. import java.io.Serializable;
  8. import java.math.BigDecimal;
  9. import java.util.List;
  10. import javax.persistence.Basic;
  11. import javax.persistence.Column;
  12. import javax.persistence.Entity;
  13. import javax.persistence.Id;
  14. import javax.persistence.NamedQueries;
  15. import javax.persistence.NamedQuery;
  16. import javax.persistence.OneToMany;
  17. import javax.persistence.Table;
  18. import javax.validation.constraints.NotNull;
  19. import javax.validation.constraints.Size;
  20. import javax.xml.bind.annotation.XmlRootElement;
  21. import javax.xml.bind.annotation.XmlTransient;
  22.  
  23. /**
  24.  *
  25.  * @author paulo
  26.  */
  27. @Entity
  28. @Table(name = "AREAS")
  29. @XmlRootElement
  30. @NamedQueries({
  31.     @NamedQuery(name = "Areas.findAll", query = "SELECT a FROM Areas a"),
  32.     @NamedQuery(name = "Areas.findById", query = "SELECT a FROM Areas a WHERE a.id = :id"),
  33.     @NamedQuery(name = "Areas.findByArea", query = "SELECT a FROM Areas a WHERE a.area = :area")})
  34. public class Areas implements Serializable {
  35.     private static final long serialVersionUID = 1L;
  36.     // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
  37.     @Id
  38.     @Basic(optional = false)
  39.     @NotNull
  40.     @Column(name = "ID")
  41.     private BigDecimal id;
  42.     @Size(max = 255)
  43.     @Column(name = "AREA")
  44.     private String area;
  45.     @OneToMany(mappedBy = "idArea")
  46.     private List<MetaBaseAtivos> metaBaseAtivosList;
  47.     @OneToMany(mappedBy = "idArea")
  48.     private List<Cr> crList;
  49.  
  50.     public Areas() {
  51.     }
  52.  
  53.     public Areas(BigDecimal id) {
  54.         this.id = id;
  55.     }
  56.  
  57.     public BigDecimal getId() {
  58.         return id;
  59.     }
  60.  
  61.     public void setId(BigDecimal id) {
  62.         this.id = id;
  63.     }
  64.  
  65.     public String getArea() {
  66.         return area;
  67.     }
  68.  
  69.     public void setArea(String area) {
  70.         this.area = area;
  71.     }
  72.  
  73.     @XmlTransient
  74.     public List<MetaBaseAtivos> getMetaBaseAtivosList() {
  75.         return metaBaseAtivosList;
  76.     }
  77.  
  78.     public void setMetaBaseAtivosList(List<MetaBaseAtivos> metaBaseAtivosList) {
  79.         this.metaBaseAtivosList = metaBaseAtivosList;
  80.     }
  81.  
  82.     @XmlTransient
  83.     public List<Cr> getCrList() {
  84.         return crList;
  85.     }
  86.  
  87.     public void setCrList(List<Cr> crList) {
  88.         this.crList = crList;
  89.     }
  90.  
  91.     @Override
  92.     public int hashCode() {
  93.         int hash = 0;
  94.         hash += (id != null ? id.hashCode() : 0);
  95.         return hash;
  96.     }
  97.  
  98.     @Override
  99.     public boolean equals(Object object) {
  100.         // TODO: Warning - this method won't work in the case the id fields are not set
  101.         if (!(object instanceof Areas)) {
  102.             return false;
  103.         }
  104.         Areas other = (Areas) object;
  105.         if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  106.             return false;
  107.         }
  108.         return true;
  109.     }
  110.  
  111.     @Override
  112.     public String toString() {
  113.         return "br.com.celg.entidade.Areas[ id=" + id + " ]";
  114.     }
  115.    
  116. }
Advertisement
Add Comment
Please, Sign In to add comment