Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package entities;
- import javax.persistence.*;
- import javax.resource.cci.Record;
- import java.util.List;
- import java.util.Set;
- import static entities.Agents.QUERY_GET_ALL_AGENTS;
- import static javax.persistence.GenerationType.IDENTITY;
- @NamedQueries(value = {
- @NamedQuery(
- name = QUERY_GET_ALL_AGENTS,
- query = "select ag from Agents ag where ag.id = :insertId"
- )
- })
- @Entity
- @Table(name="Agents")
- public class Agents {
- public static final String QUERY_GET_ALL_AGENTS = "GET_ALL_AGENTS";
- @Id
- @GeneratedValue(strategy = IDENTITY)
- @Column
- private int id;
- @Column(name="firstName")
- private String firstName;
- @Column(name="lastName")
- private String lastName;
- @Column(name="link")
- private String link;
- @ManyToMany(fetch = FetchType.EAGER, mappedBy = "agents")
- private Set<Record> records;
- public Set<Record> getRecords() {
- return records;
- }
- public void setRecords(Set<Record> records) {
- this.records = records;
- }
- public Agents(int id, String firstName, String lastName, String link) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.link = link;
- }
- public Agents(int id, String firstName, String lastName, String link, int tend_id) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.link = link;
- }
- public Agents() {
- }
- /* @ManyToMany
- private Set<Records> records;*/
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getFirstName() {
- return firstName;
- }
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
- public String getLastName() {
- return lastName;
- }
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- public String getLink() {
- return link;
- }
- public void setLink(String link) {
- this.link = link;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement