Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. package softuniGallery.entity;
  2.  
  3. import javax.persistence.*;
  4. import java.util.HashSet;
  5. import java.util.Set;
  6.  
  7. @Entity
  8. @Table(name = "linkCategories")
  9. public class LinkCategory {
  10. private Integer id;
  11. private String name;
  12. private Set<Link> links;
  13.  
  14.  
  15. public LinkCategory() {
  16.  
  17. }
  18.  
  19. public LinkCategory(String name) {
  20. this.name = name;
  21. this.links = new HashSet<>();
  22. }
  23.  
  24. @Id
  25. @GeneratedValue(strategy = GenerationType.IDENTITY)
  26. public Integer getId() {
  27. return this.id;
  28. }
  29.  
  30. public void setId(Integer id) {
  31. this.id = id;
  32. }
  33.  
  34. @Column(nullable = false, unique = true)
  35. public String getName() {
  36. return this.name;
  37. }
  38.  
  39. public void setName(String name) {
  40. this.name = name;
  41. }
  42.  
  43. @OneToMany(mappedBy = "linkCategory")
  44. public Set<Link> getLinks() {
  45. return this.links;
  46. }
  47.  
  48. public void setLinks(Set<Link> links) {
  49. this.links = links;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement