Guest User

Untitled

a guest
Jun 15th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. @Entity
  2. @Table(name = "user")
  3. public class User {
  4. @GeneratedValue(strategy = GenerationType.IDENTITY)
  5. private Long id;
  6. @Column(unique=true)
  7. @Id
  8. private String login;
  9. private String password;
  10. private String firstName;
  11. private String lastName;
  12. private String city;
  13. private int age;
  14. private Sex sex ;
  15. @OneToOne(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.ALL)
  16. private UserProfile userProfile;
  17.  
  18.  
  19. @Entity
  20. @Table(name = "user_profile")
  21. public class UserProfile {
  22. @GeneratedValue(strategy = GenerationType.IDENTITY)
  23. private Long Id;
  24. @Id
  25. private String login;
  26. private String user_interestings;
  27.  
  28. @OneToOne
  29. @MapsId
  30. private User user;
Add Comment
Please, Sign In to add comment