Advertisement
Guest User

Untitled

a guest
Feb 8th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. package com.opinurate.wonderoffer.model;
  2.  
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.security.crypto.bcrypt.BCrypt;
  5. import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
  6. import org.springframework.security.crypto.password.PasswordEncoder;
  7.  
  8. import javax.persistence.*;
  9. import java.util.Collection;
  10. import java.util.HashSet;
  11.  
  12. @Entity
  13. @Table(name = "USER")
  14. public class User {
  15.  
  16. @Id
  17. @Column(name = "userID")
  18. @GeneratedValue(strategy = GenerationType.AUTO)
  19. private Long userId;
  20.  
  21. @Column(name = "username")
  22. private String username;
  23.  
  24. @Column(name = "password")
  25. private String password;
  26.  
  27. @Column(name = "forename")
  28. private String forename;
  29.  
  30. @Column(name = "surname")
  31. private String surname;
  32.  
  33. @Column(name = "email")
  34. private String email;
  35.  
  36. @Column(name = "fullName")
  37. private String fullName = forename + " " + surname;
  38.  
  39. @OneToMany(mappedBy = "email", targetEntity = Booking.class)
  40. private Collection<Booking> bookings = new HashSet<>();
  41.  
  42. public Long getId() { return userId; }
  43. public void setId(Long id) { this.userId = id; }
  44. public String getUsername() { return username; }
  45. public void setUsername(String username) { this.username = username; }
  46. public String getPassword() { return password; }
  47. public void setPassword(String password) { this.password = password;}
  48. public String getForename(){return forename;}
  49. public void setForename(String forename){this.forename = forename; }
  50. public String getSurname(){return surname;}
  51. public void setSurname(String surname){this.surname = surname;}
  52. public String getEmail(){return email;}
  53. public void setEmail(String email){this.email = email;}
  54. public String getFullName() { return fullName; }
  55. public void setFullName(String fullName) { this.fullName = forename + " " + surname; }
  56.  
  57.  
  58.  
  59. public Collection<Booking> getBookings() {
  60. return bookings;
  61. }
  62.  
  63. public void setBookings(Collection<Booking> bookings) {
  64. this.bookings = bookings;
  65. }
  66.  
  67. public User() { }
  68.  
  69. public User(Long id, String username, String fullName){
  70. this.userId = id; this.username = username; this.fullName = fullName;
  71. }
  72.  
  73. @Override
  74. public String toString() {
  75. return "User{" + "id=" + userId + ", username='" + username + '\'' +
  76. ", password='" + password + '\'' +
  77. ", fullName='" + fullName + '\'' + '}';
  78. }
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement