Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. private static final long serialVersionUID = -3009157732242241606L;
  2. @Id
  3. @GeneratedValue(strategy = GenerationType.AUTO)
  4. private long id;
  5.  
  6. @Column(name = "name")
  7. private String name;
  8.  
  9. @Column(name = "password")
  10. private String password;
  11.  
  12. @Column(name = "email")
  13. private String email;
  14.  
  15. @OneToMany
  16. private Set<Friendship> friends = new HashSet<>();
  17.  
  18. public User(){
  19.  
  20. }
  21.  
  22. @Entity
  23. @Table(name = "Friendship")
  24. public class Friendship implements Serializable {
  25.  
  26. private static final long serialVersionUID = -3009157732242241606L;
  27. @Id
  28. @GeneratedValue(strategy = GenerationType.AUTO)
  29. private long id;
  30.  
  31. @ManyToOne
  32. private User owner;
  33.  
  34. @ManyToOne
  35. @MapsId("id")
  36. private User friend;
  37.  
  38. public Friendship() {
  39.  
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement