Guest User

Untitled

a guest
Nov 13th, 2016
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  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 javax.persistence.Entity;
  10. import javax.persistence.GeneratedValue;
  11. import javax.persistence.GenerationType;
  12. import javax.persistence.Id;
  13. import javax.persistence.SequenceGenerator;
  14.  
  15. /**
  16. *
  17. * @author Jarek
  18. */
  19. @Entity
  20. public class User implements Serializable {
  21.  
  22. private static final long serialVersionUID = 1L;
  23. @Id
  24. @SequenceGenerator(name = "entity1Seq", sequenceName="USER_ID_GEN1", allocationSize=1)
  25. @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "entity1Seq")
  26.  
  27. private Long id;
  28. private String username;
  29. private String password;
  30.  
  31. public String getUsername() {
  32. return username;
  33. }
  34.  
  35. public void setUsername(String username) {
  36. this.username = username;
  37. }
  38.  
  39. public String getPassword() {
  40. return password;
  41. }
  42.  
  43. public void setPassword(String password) {
  44. this.password = password;
  45. }
  46.  
  47. public Long getId() {
  48. return id;
  49. }
  50.  
  51. public void setId(Long id) {
  52. this.id = id;
  53. }
  54.  
  55. @Override
  56. public int hashCode() {
  57. int hash = 0;
  58. hash += (id != null ? id.hashCode() : 0);
  59. return hash;
  60. }
  61.  
  62. @Override
  63. public boolean equals(Object object) {
  64. // TODO: Warning - this method won't work in the case the id fields are not set
  65. if (!(object instanceof User)) {
  66. return false;
  67. }
  68. User other = (User) object;
  69. if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  70. return false;
  71. }
  72. return true;
  73. }
  74.  
  75. @Override
  76. public String toString() {
  77. return "entities.User[ id=" + id + " ]";
  78. }
  79.  
  80. }
Add Comment
Please, Sign In to add comment