diff options
Diffstat (limited to 'src/jpa/Product.java')
| -rw-r--r-- | src/jpa/Product.java | 155 |
1 files changed, 86 insertions, 69 deletions
diff --git a/src/jpa/Product.java b/src/jpa/Product.java index baf29ca..8196b73 100644 --- a/src/jpa/Product.java +++ b/src/jpa/Product.java @@ -1,105 +1,122 @@ package jpa; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.util.Set; +import javax.persistence.Entity; +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; +@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 - private int id; + @Id + private int id; - @Lob - private String description; + @Lob + private String description; - private BigDecimal height; + private BigDecimal height; - private String name; + private String name; - private BigDecimal price; + private BigDecimal price; - private BigDecimal width; + 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 Set<Category> categories; + // bi-directional many-to-many association to Category + @ManyToMany + @JoinTable(name = "product_category", joinColumns = { + @JoinColumn(name = "product_id") }, inverseJoinColumns = { + @JoinColumn(name = "category_id") }) + private Set<Category> categories; - public Product() { - } + public Product() + { + } - public int getId() { - return this.id; - } + public int getId() + { + return this.id; + } - public void setId(int id) { - this.id = id; - } + public void setId(int id) + { + this.id = id; + } - public String getDescription() { - return this.description; - } + public String getDescription() + { + return this.description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) + { + this.description = description; + } - public BigDecimal getHeight() { - return this.height; - } + public BigDecimal getHeight() + { + return this.height; + } - public void setHeight(BigDecimal height) { - this.height = height; - } + public void setHeight(BigDecimal height) + { + this.height = height; + } - public String getName() { - return this.name; - } + public String getName() + { + return this.name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) + { + this.name = name; + } - public BigDecimal getPrice() { - return this.price; - } + public BigDecimal getPrice() + { + return this.price; + } - public void setPrice(BigDecimal price) { - this.price = price; - } + public void setPrice(BigDecimal price) + { + this.price = price; + } - public BigDecimal getWidth() { - return this.width; - } + public BigDecimal getWidth() + { + return this.width; + } - public void setWidth(BigDecimal width) { - this.width = width; - } + public void setWidth(BigDecimal width) + { + this.width = width; + } - public Set<Category> getCategories() { - return this.categories; - } + public Set<Category> getCategories() + { + return this.categories; + } - public void setCategories(Set<Category> categories) { - this.categories = categories; - } + public void setCategories(Set<Category> categories) + { + this.categories = categories; + } }
\ No newline at end of file |
