From f630bdee3de1efeda671b39a8745ecf60edcd891 Mon Sep 17 00:00:00 2001
From: Jan Tymel <410388@mail.muni.cz>
Date: Wed, 10 Feb 2021 05:57:07 +0100
Subject: [PATCH] Explicitly set strategy of generated value of entities' ID to
 IDENTITY

---
 .../muni/ics/kypo/training/adaptive/domain/AbstractPhase.java  | 3 ++-
 .../ics/kypo/training/adaptive/domain/DecisionMatrixRow.java   | 3 ++-
 .../cz/muni/ics/kypo/training/adaptive/domain/Question.java    | 3 ++-
 .../muni/ics/kypo/training/adaptive/domain/QuestionChoice.java | 3 ++-
 .../kypo/training/adaptive/domain/QuestionPhaseRelation.java   | 3 ++-
 .../java/cz/muni/ics/kypo/training/adaptive/domain/Task.java   | 3 ++-
 6 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/AbstractPhase.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/AbstractPhase.java
index 36ec29d8..2ea187e1 100644
--- a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/AbstractPhase.java
+++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/AbstractPhase.java
@@ -4,6 +4,7 @@ package cz.muni.ics.kypo.training.adaptive.domain;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Inheritance;
 import javax.persistence.InheritanceType;
@@ -17,7 +18,7 @@ import java.io.Serializable;
 public abstract class AbstractPhase implements Serializable {
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
     private String title;
diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/DecisionMatrixRow.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/DecisionMatrixRow.java
index b2c12701..0f383b0e 100644
--- a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/DecisionMatrixRow.java
+++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/DecisionMatrixRow.java
@@ -4,6 +4,7 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.ManyToOne;
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.io.Serializable;
 public class DecisionMatrixRow implements Serializable {
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
     @Column(name = "order_in_phase", nullable = false)
diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Question.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Question.java
index 83822286..636214aa 100644
--- a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Question.java
+++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Question.java
@@ -9,6 +9,7 @@ import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.ManyToMany;
 import javax.persistence.ManyToOne;
@@ -25,7 +26,7 @@ import java.util.Set;
 public class Question implements Serializable  {
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
     @Enumerated(EnumType.STRING)
diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionChoice.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionChoice.java
index 45f90ba3..c681f6be 100644
--- a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionChoice.java
+++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionChoice.java
@@ -4,6 +4,7 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.ManyToOne;
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.io.Serializable;
 public class QuestionChoice implements Serializable {
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
     private String text;
diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionPhaseRelation.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionPhaseRelation.java
index 8321edc0..b31dfe09 100644
--- a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionPhaseRelation.java
+++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/QuestionPhaseRelation.java
@@ -5,6 +5,7 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
@@ -17,7 +18,7 @@ import java.util.Set;
 public class QuestionPhaseRelation implements Serializable {
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
     @Column(name = "order_in_questionnaire", nullable = false)
diff --git a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Task.java b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Task.java
index 94464309..e5515722 100644
--- a/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Task.java
+++ b/src/main/java/cz/muni/ics/kypo/training/adaptive/domain/Task.java
@@ -4,6 +4,7 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.ManyToOne;
 import java.io.Serializable;
@@ -13,7 +14,7 @@ import java.io.Serializable;
 public class Task implements Serializable {
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
     private String title;
-- 
GitLab