Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package entities;
- import jdk.internal.agent.Agent;
- import javax.persistence.*;
- import java.sql.Timestamp;
- import java.util.Set;
- import static entities.Records.QUERY_GET_ALL_RECORDS;
- @NamedQueries(value = {
- @NamedQuery(
- name = "Records.getRecordById",
- query = "select rec from Records rec where rec.id = :insertId"
- ),
- @NamedQuery(
- name = QUERY_GET_ALL_RECORDS,
- query = "select rec from Records rec")
- })
- @Entity
- @Table(name="records")
- public class Records {
- public static final String QUERY_GET_ALL_RECORDS = "GET_ALL_RECORDS";
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private int id;
- @Column(name = "name")
- private String name;
- @Column(name = "link")
- private String link;
- @Column(name = "price")
- private int price;
- @Column(name = "costs")
- private int costs;
- @Column(name = "discription")
- private String discription;
- @Column(name = "date")
- private Timestamp date;
- @Column(name = "actually")
- private boolean actually;
- @ManyToMany
- @JoinTable(name="record_agent",
- joinColumns = @JoinColumn(name="record_id", referencedColumnName="id"),
- inverseJoinColumns = @JoinColumn(name="agent_id", referencedColumnName="id")
- )
- private Set<Agent> agents;
- public Records(int id, String name, String link, int price, Timestamp date, Boolean actually, int costs, String discription, Set<Agent> agents) {
- this.id = id;
- this.name = name;
- this.link = link;
- this.price = price;
- this.date = date;
- this.actually = actually;
- this.costs = costs;
- this.discription = discription;
- this.agents = agents;
- }
- public Records() {
- }
- /* @ManyToMany
- @JoinTable(
- )
- private Set<Agents> agents;*/
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getLink() {
- return link;
- }
- public void setLink(String link) {
- this.link = link;
- }
- public int getPrice() {
- return price;
- }
- public void setPrice(int price) {
- this.price = price;
- }
- public int getCosts() {
- return costs;
- }
- public void setCosts(int costs) {
- this.costs = costs;
- }
- public String getDiscription() {
- return discription;
- }
- public void setDiscription(String discription) {
- this.discription = discription;
- }
- public Timestamp getDate() {
- return date;
- }
- public void setDate(Timestamp date) {
- this.date = date;
- }
- public boolean isActually() {
- return actually;
- }
- public void setActually(boolean actually) {
- this.actually = actually;
- }
- public Set<Agent> getAgents() {
- return agents;
- }
- public void setAgents(Set<Agent> agents) {
- this.agents = agents;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement