Advertisement
AmazingPlamen

Address

Feb 25th, 2020
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. package entities;
  2.  
  3. import javax.persistence.*;
  4. import java.util.Set;
  5.  
  6. @Entity
  7. @Table(name = "addresses")
  8. public class Address {
  9. private Integer id;
  10. private String text;
  11. private Town town;
  12. private Set<Employee> employees;
  13.  
  14. @Id
  15. @GeneratedValue(strategy = GenerationType.IDENTITY)
  16. @Column(name = "address_id")
  17. public Integer getId() {
  18. return id;
  19. }
  20.  
  21. public void setId(Integer id) {
  22. this.id = id;
  23. }
  24.  
  25. @Column(name = "address_text")
  26. public String getText() {
  27. return text;
  28. }
  29.  
  30. public void setText(String text) {
  31. this.text = text;
  32. }
  33.  
  34. @ManyToOne
  35. @JoinColumn(name = "town_id",referencedColumnName = "town_id")
  36. public Town getTown() {
  37. return town;
  38. }
  39.  
  40. public void setTown(Town town) {
  41. this.town = town;
  42. }
  43.  
  44. @OneToMany(mappedBy = "address")
  45. public Set<Employee> getEmployees() {
  46. return employees;
  47. }
  48.  
  49. public void setEmployees(Set<Employee> employees) {
  50. this.employees = employees;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement