summaryrefslogtreecommitdiffstats
path: root/src/jpa
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-12-13 20:58:10 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-12-13 23:34:50 +0100
commit10331ccbacbff885201eb33998007228c4caa962 (patch)
tree6c4cef0275e298ed053cc0d2c8cb41b5c7c11342 /src/jpa
parent807ec1d9f4587768b2e0387bbf428eed6d86dc30 (diff)
downloadJCatalog-master.tar.gz
JCatalog-master.zip
Fix Database autoincrementHEADmaster
Diffstat (limited to 'src/jpa')
-rw-r--r--src/jpa/Category.java4
-rw-r--r--src/jpa/Product.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/jpa/Category.java b/src/jpa/Category.java
index bbd832d..8b30db9 100644
--- a/src/jpa/Category.java
+++ b/src/jpa/Category.java
@@ -4,6 +4,8 @@ import java.io.Serializable;
import java.util.Set;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQuery;
@@ -20,7 +22,7 @@ public class Category implements Serializable
{
private static final long serialVersionUID = 1L;
- @Id
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String description;
diff --git a/src/jpa/Product.java b/src/jpa/Product.java
index 8196b73..92ec695 100644
--- a/src/jpa/Product.java
+++ b/src/jpa/Product.java
@@ -5,6 +5,8 @@ import java.math.BigDecimal;
import java.util.Set;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
@@ -24,7 +26,7 @@ public class Product implements Serializable
{
private static final long serialVersionUID = 1L;
- @Id
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@Lob