Rodrigo_Marden

Entidade MetaBase

Jan 9th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.67 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.Date;
  10. import javax.persistence.Basic;
  11. import javax.persistence.Column;
  12. import javax.persistence.Entity;
  13. import javax.persistence.Id;
  14. import javax.persistence.JoinColumn;
  15. import javax.persistence.ManyToOne;
  16. import javax.persistence.NamedQueries;
  17. import javax.persistence.NamedQuery;
  18. import javax.persistence.Table;
  19. import javax.persistence.Temporal;
  20. import javax.persistence.TemporalType;
  21. import javax.validation.constraints.NotNull;
  22. import javax.xml.bind.annotation.XmlRootElement;
  23.  
  24. /**
  25.  *
  26.  * @author paulo
  27.  */
  28. @Entity
  29. @Table(name = "META_BASE_ATIVOS")
  30. @XmlRootElement
  31. @NamedQueries({
  32.     @NamedQuery(name = "MetaBaseAtivos.findAll", query = "SELECT m FROM MetaBaseAtivos m"),
  33.     @NamedQuery(name = "MetaBaseAtivos.findById", query = "SELECT m FROM MetaBaseAtivos m WHERE m.id = :id"),
  34.     @NamedQuery(name = "MetaBaseAtivos.findByDataMeta", query = "SELECT m FROM MetaBaseAtivos m WHERE m.dataMeta = :dataMeta"),
  35.     @NamedQuery(name = "MetaBaseAtivos.findByMetaGross", query = "SELECT m FROM MetaBaseAtivos m WHERE m.metaGross = :metaGross"),
  36.     @NamedQuery(name = "MetaBaseAtivos.findByMetaNet", query = "SELECT m FROM MetaBaseAtivos m WHERE m.metaNet = :metaNet")})
  37. public class MetaBaseAtivos implements Serializable {
  38.     private static final long serialVersionUID = 1L;
  39.     // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
  40.     @Id
  41.     @Basic(optional = false)
  42.     @NotNull
  43.     @Column(name = "ID")
  44.     private BigDecimal id;
  45.     @Column(name = "DATA_META")
  46.     @Temporal(TemporalType.TIMESTAMP)
  47.     private Date dataMeta;
  48.     @Column(name = "META_GROSS")
  49.     private BigDecimal metaGross;
  50.     @Column(name = "META_NET")
  51.     private BigDecimal metaNet;
  52.     @JoinColumn(name = "ID_AREA", referencedColumnName = "ID")
  53.     @ManyToOne
  54.     private Areas idArea;
  55.  
  56.     public MetaBaseAtivos() {
  57.     }
  58.  
  59.     public MetaBaseAtivos(BigDecimal id) {
  60.         this.id = id;
  61.     }
  62.  
  63.     public BigDecimal getId() {
  64.         return id;
  65.     }
  66.  
  67.     public void setId(BigDecimal id) {
  68.         this.id = id;
  69.     }
  70.  
  71.     public Date getDataMeta() {
  72.         return dataMeta;
  73.     }
  74.  
  75.     public void setDataMeta(Date dataMeta) {
  76.         this.dataMeta = dataMeta;
  77.     }
  78.  
  79.     public BigDecimal getMetaGross() {
  80.         return metaGross;
  81.     }
  82.  
  83.     public void setMetaGross(BigDecimal metaGross) {
  84.         this.metaGross = metaGross;
  85.     }
  86.  
  87.     public BigDecimal getMetaNet() {
  88.         return metaNet;
  89.     }
  90.  
  91.     public void setMetaNet(BigDecimal metaNet) {
  92.         this.metaNet = metaNet;
  93.     }
  94.  
  95.     public Areas getIdArea() {
  96.         return idArea;
  97.     }
  98.  
  99.     public void setIdArea(Areas idArea) {
  100.         this.idArea = idArea;
  101.     }
  102.  
  103.     @Override
  104.     public int hashCode() {
  105.         int hash = 0;
  106.         hash += (id != null ? id.hashCode() : 0);
  107.         return hash;
  108.     }
  109.  
  110.     @Override
  111.     public boolean equals(Object object) {
  112.         // TODO: Warning - this method won't work in the case the id fields are not set
  113.         if (!(object instanceof MetaBaseAtivos)) {
  114.             return false;
  115.         }
  116.         MetaBaseAtivos other = (MetaBaseAtivos) object;
  117.         if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  118.             return false;
  119.         }
  120.         return true;
  121.     }
  122.  
  123.     @Override
  124.     public String toString() {
  125.         return "br.com.celg.entidade.MetaBaseAtivos[ id=" + id + " ]";
  126.     }
  127.    
  128. }
Advertisement
Add Comment
Please, Sign In to add comment