Domain model change
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / db / ep / EpNotification.java
index ab1bf73..a10cc3e 100644 (file)
@@ -40,9 +40,9 @@
 
 package org.onap.portal.domain.db.ep;
 
+import java.io.Serializable;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -51,6 +51,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.FutureOrPresent;
@@ -89,10 +90,11 @@ CREATE TABLE `ep_notification` (
 @Getter
 @Setter
 @Entity
-public class EpNotification {
+public class EpNotification implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "notification_ID", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
+       @Column(name = "notification_ID", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        private Long notificationID;
        @Column(name = "is_for_online_users", length = 1, columnDefinition = "char(1) default 'N'")
@@ -145,15 +147,15 @@ public class EpNotification {
        @OneToMany(
                targetEntity = EpRoleNotification.class,
                mappedBy = "notificationID",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
-       private List<EpRoleNotification> epRoleNotifications = new ArrayList<>();
+       private Set<EpRoleNotification> epRoleNotifications;
        @OneToMany(
                targetEntity = EpUserNotification.class,
                mappedBy = "notificationId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
-       private List<EpUserNotification> epUserNotifications = new ArrayList<>();
+       private Set<EpUserNotification> epUserNotifications;
 }