SHARE
TWEET

Untitled

a guest Jul 18th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package entities;
  7.  
  8. import java.io.Serializable;
  9. import java.math.BigDecimal;
  10. import java.util.List;
  11. import javax.persistence.Basic;
  12. import javax.persistence.Column;
  13. import javax.persistence.Entity;
  14. import javax.persistence.Id;
  15. import javax.persistence.JoinColumn;
  16. import javax.persistence.JoinTable;
  17. import javax.persistence.ManyToMany;
  18. import javax.persistence.NamedQueries;
  19. import javax.persistence.NamedQuery;
  20. import javax.persistence.Table;
  21. import javax.validation.constraints.NotNull;
  22. import javax.validation.constraints.Size;
  23. import javax.xml.bind.annotation.XmlRootElement;
  24. import javax.xml.bind.annotation.XmlTransient;
  25.  
  26. /**
  27.  *
  28.  * @author Krisztian
  29.  */
  30. @Entity
  31. @Table(name = "PERSONS")
  32. @XmlRootElement
  33. @NamedQueries({
  34.     @NamedQuery(name = "Persons.findAll", query = "SELECT p FROM Persons p")
  35.     , @NamedQuery(name = "Persons.findByPersonid", query = "SELECT p FROM Persons p WHERE p.personid = :personid")
  36.     , @NamedQuery(name = "Persons.findByPassword", query = "SELECT p FROM Persons p WHERE p.password = :password")
  37.     , @NamedQuery(name = "Persons.findByPersonname", query = "SELECT p FROM Persons p WHERE p.personname = :personname")
  38.     , @NamedQuery(name = "Persons.findByGender", query = "SELECT p FROM Persons p WHERE p.gender = :gender")
  39.     , @NamedQuery(name = "Persons.findByFamilyrole", query = "SELECT p FROM Persons p WHERE p.familyrole = :familyrole")})
  40. public class Persons implements Serializable {
  41.  
  42.     private static final long serialVersionUID = 1L;
  43.     // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
  44.     @Id
  45.     @Basic(optional = false)
  46.     @NotNull
  47.     @Column(name = "PERSONID")
  48.     private BigDecimal personid;
  49.     @Size(max = 255)
  50.     @Column(name = "PASSWORD")
  51.     private String password;
  52.     @Size(max = 255)
  53.     @Column(name = "PERSONNAME")
  54.     private String personname;
  55.     @Size(max = 255)
  56.     @Column(name = "GENDER")
  57.     private String gender;
  58.     @Size(max = 255)
  59.     @Column(name = "FAMILYROLE")
  60.     private String familyrole;
  61.     @JoinTable(name = "PERSONAPPRELATION", joinColumns = {
  62.         @JoinColumn(name = "PERSONID", referencedColumnName = "PERSONID")}, inverseJoinColumns = {
  63.         @JoinColumn(name = "APPID", referencedColumnName = "APPID")})
  64.     @ManyToMany
  65.     private List<Apps> appsList;
  66.  
  67.     public Persons() {
  68.     }
  69.  
  70.     public Persons(BigDecimal personid) {
  71.         this.personid = personid;
  72.     }
  73.  
  74.     public BigDecimal getPersonid() {
  75.         return personid;
  76.     }
  77.  
  78.     public void setPersonid(BigDecimal personid) {
  79.         this.personid = personid;
  80.     }
  81.  
  82.     public String getPassword() {
  83.         return password;
  84.     }
  85.  
  86.     public void setPassword(String password) {
  87.         this.password = password;
  88.     }
  89.  
  90.     public String getPersonname() {
  91.         return personname;
  92.     }
  93.  
  94.     public void setPersonname(String personname) {
  95.         this.personname = personname;
  96.     }
  97.  
  98.     public String getGender() {
  99.         return gender;
  100.     }
  101.  
  102.     public void setGender(String gender) {
  103.         this.gender = gender;
  104.     }
  105.  
  106.     public String getFamilyrole() {
  107.         return familyrole;
  108.     }
  109.  
  110.     public void setFamilyrole(String familyrole) {
  111.         this.familyrole = familyrole;
  112.     }
  113.  
  114.     @XmlTransient
  115.     public List<Apps> getAppsList() {
  116.         return appsList;
  117.     }
  118.  
  119.     public void setAppsList(List<Apps> appsList) {
  120.         this.appsList = appsList;
  121.     }
  122.  
  123.     @Override
  124.     public int hashCode() {
  125.         int hash = 0;
  126.         hash += (personid != null ? personid.hashCode() : 0);
  127.         return hash;
  128.     }
  129.  
  130.     @Override
  131.     public boolean equals(Object object) {
  132.         // TODO: Warning - this method won't work in the case the id fields are not set
  133.         if (!(object instanceof Persons)) {
  134.             return false;
  135.         }
  136.         Persons other = (Persons) object;
  137.         if ((this.personid == null && other.personid != null) || (this.personid != null && !this.personid.equals(other.personid))) {
  138.             return false;
  139.         }
  140.         return true;
  141.     }
  142.  
  143.     @Override
  144.     public String toString() {
  145.         return "entities.Persons[ personid=" + personid + " ]";
  146.     }
  147.    
  148. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top