Advertisement
Guest User

Untitled

a guest
May 8th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. package com.hellokoding.account.model;
  2.  
  3.  
  4. import javax.persistence.*;
  5. import java.util.List;
  6. import java.util.Set;
  7.  
  8. @Entity
  9. @Table(name = "user")
  10. public class User {
  11. private Long id;
  12. private String username;
  13. private String password;
  14. private String passwordConfirm;
  15. private Set<Role> roles;
  16. private List<Reservation> reservation;
  17.  
  18. @Id
  19. @GeneratedValue(strategy = GenerationType.AUTO)
  20. public Long getId() {
  21. return id;
  22. }
  23.  
  24. @OneToMany(
  25. cascade = CascadeType.ALL,
  26. orphanRemoval = true
  27. )
  28. @JoinColumn(name = "res_id")
  29. public List<Reservation> getReservation() {
  30. return reservation;
  31. }
  32.  
  33. public void setReservation(List<Reservation> reservation) {
  34. this.reservation = reservation;
  35. }
  36.  
  37.  
  38. public void setId(Long id) {
  39. this.id = id;
  40. }
  41.  
  42. public String getUsername() {
  43. return username;
  44. }
  45.  
  46. public void setUsername(String username) {
  47. this.username = username;
  48. }
  49.  
  50. public String getPassword() {
  51. return password;
  52. }
  53.  
  54. public void setPassword(String password) {
  55. this.password = password;
  56. }
  57.  
  58. @Transient
  59. public String getPasswordConfirm() {
  60. return passwordConfirm;
  61. }
  62.  
  63. public void setPasswordConfirm(String passwordConfirm) {
  64. this.passwordConfirm = passwordConfirm;
  65. }
  66.  
  67. @ManyToMany
  68. @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
  69. public Set<Role> getRoles() {
  70. return roles;
  71. }
  72.  
  73. public void setRoles(Set<Role> roles) {
  74. this.roles = roles;
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement