summaryrefslogtreecommitdiffstats
path: root/src/jpa/Product.java
blob: 7a8f0c49dbec6b4e4708f8cbc8401b9b54705375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package jpa;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * The persistent class for the product database table.
 * 
 */
@Entity
@Table(name = "product")
@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p")
public class Product implements Serializable
{
   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private int id;

   @Lob
   private String description;

   private BigDecimal height;

   private String name;

   private BigDecimal price;

   private BigDecimal width;

   // bi-directional many-to-many association to Category
   @ManyToMany
   @JoinTable(name = "product_category", joinColumns = {
         @JoinColumn(name = "product_id") }, inverseJoinColumns = {
               @JoinColumn(name = "category_id") })
   private Collection<Category> categories;

   public Product()
   {
   }

   public int getId()
   {
      return this.id;
   }

   public void setId(int id)
   {
      this.id = id;
   }

   public String getDescription()
   {
      return this.description;
   }

   public void setDescription(String description)
   {
      this.description = description;
   }

   public BigDecimal getHeight()
   {
      return this.height;
   }

   public void setHeight(BigDecimal height)
   {
      this.height = height;
   }

   public String getName()
   {
      return this.name;
   }

   public void setName(String name)
   {
      this.name = name;
   }

   public BigDecimal getPrice()
   {
      return this.price;
   }

   public void setPrice(BigDecimal price)
   {
      this.price = price;
   }

   public BigDecimal getWidth()
   {
      return this.width;
   }

   public void setWidth(BigDecimal width)
   {
      this.width = width;
   }

   public Collection<Category> getCategories()
   {
      return this.categories;
   }

   public void setCategories(Collection<Category> categories)
   {
      this.categories = categories;
   }

}