diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-12-14 01:09:45 +0100 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-12-14 01:09:45 +0100 |
| commit | 188c3afc3b8396fba1d5d7767b5ec8f21b6d9732 (patch) | |
| tree | 3126791a636dba733875ef423bbed4e217293308 /src/jpa | |
| parent | 872c4e65f6d740d60acf378838f843e8586255c9 (diff) | |
| download | JCatalog-188c3afc3b8396fba1d5d7767b5ec8f21b6d9732.tar.gz JCatalog-188c3afc3b8396fba1d5d7767b5ec8f21b6d9732.zip | |
Change Set to Collection for better testing
Diffstat (limited to 'src/jpa')
| -rw-r--r-- | src/jpa/Category.java | 11 | ||||
| -rw-r--r-- | src/jpa/Product.java | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/jpa/Category.java b/src/jpa/Category.java index 8b30db9..431635c 100644 --- a/src/jpa/Category.java +++ b/src/jpa/Category.java @@ -1,7 +1,7 @@ package jpa; import java.io.Serializable; -import java.util.Set; +import java.util.Collection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -22,7 +22,8 @@ public class Category implements Serializable { private static final long serialVersionUID = 1L; - @Id @GeneratedValue(strategy=GenerationType.IDENTITY) + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String description; @@ -31,7 +32,7 @@ public class Category implements Serializable // bi-directional many-to-many association to Product @ManyToMany(mappedBy = "categories") - private Set<Product> products; + private Collection<Product> products; public Category() { @@ -67,12 +68,12 @@ public class Category implements Serializable this.name = name; } - public Set<Product> getProducts() + public Collection<Product> getProducts() { return this.products; } - public void setProducts(Set<Product> products) + public void setProducts(Collection<Product> products) { this.products = products; } diff --git a/src/jpa/Product.java b/src/jpa/Product.java index 92ec695..7a8f0c4 100644 --- a/src/jpa/Product.java +++ b/src/jpa/Product.java @@ -2,7 +2,7 @@ package jpa; import java.io.Serializable; import java.math.BigDecimal; -import java.util.Set; +import java.util.Collection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -26,7 +26,8 @@ public class Product implements Serializable { private static final long serialVersionUID = 1L; - @Id @GeneratedValue(strategy=GenerationType.IDENTITY) + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Lob @@ -45,7 +46,7 @@ public class Product implements Serializable @JoinTable(name = "product_category", joinColumns = { @JoinColumn(name = "product_id") }, inverseJoinColumns = { @JoinColumn(name = "category_id") }) - private Set<Category> categories; + private Collection<Category> categories; public Product() { @@ -111,12 +112,12 @@ public class Product implements Serializable this.width = width; } - public Set<Category> getCategories() + public Collection<Category> getCategories() { return this.categories; } - public void setCategories(Set<Category> categories) + public void setCategories(Collection<Category> categories) { this.categories = categories; } |
