Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. package entities;
  2.  
  3.  
  4. import javax.persistence.*;
  5. import javax.resource.cci.Record;
  6.  
  7. import java.util.List;
  8. import java.util.Set;
  9.  
  10. import static entities.Agents.QUERY_GET_ALL_AGENTS;
  11. import static javax.persistence.GenerationType.IDENTITY;
  12.  
  13.  
  14. @NamedQueries(value = {
  15. @NamedQuery(
  16. name = QUERY_GET_ALL_AGENTS,
  17. query = "select ag from Agents ag where ag.id = :insertId"
  18. )
  19. })
  20. @Entity
  21. @Table(name="Agents")
  22. public class Agents {
  23.  
  24. public static final String QUERY_GET_ALL_AGENTS = "GET_ALL_AGENTS";
  25.  
  26. @Id
  27. @GeneratedValue(strategy = IDENTITY)
  28. @Column
  29. private int id;
  30. @Column(name="firstName")
  31. private String firstName;
  32. @Column(name="lastName")
  33. private String lastName;
  34. @Column(name="link")
  35. private String link;
  36. @ManyToMany(fetch = FetchType.EAGER, mappedBy = "agents")
  37. private Set<Record> records;
  38.  
  39. public Set<Record> getRecords() {
  40. return records;
  41. }
  42.  
  43. public void setRecords(Set<Record> records) {
  44. this.records = records;
  45. }
  46.  
  47. public Agents(int id, String firstName, String lastName, String link) {
  48. this.id = id;
  49. this.firstName = firstName;
  50. this.lastName = lastName;
  51. this.link = link;
  52. }
  53.  
  54. public Agents(int id, String firstName, String lastName, String link, int tend_id) {
  55. this.id = id;
  56. this.firstName = firstName;
  57. this.lastName = lastName;
  58. this.link = link;
  59.  
  60. }
  61.  
  62. public Agents() {
  63. }
  64.  
  65.  
  66. /* @ManyToMany
  67. private Set<Records> records;*/
  68.  
  69. public int getId() {
  70. return id;
  71. }
  72.  
  73. public void setId(int id) {
  74. this.id = id;
  75. }
  76.  
  77. public String getFirstName() {
  78. return firstName;
  79. }
  80.  
  81. public void setFirstName(String firstName) {
  82. this.firstName = firstName;
  83. }
  84.  
  85. public String getLastName() {
  86. return lastName;
  87. }
  88.  
  89. public void setLastName(String lastName) {
  90. this.lastName = lastName;
  91. }
  92.  
  93. public String getLink() {
  94. return link;
  95. }
  96.  
  97. public void setLink(String link) {
  98. this.link = link;
  99. }
  100.  
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement