UserNotificationController up
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / db / ep / EpRoleNotification.java
index 6bfc233..95ffbf2 100644 (file)
@@ -40,6 +40,7 @@
 
 package org.onap.portal.domain.db.ep;
 
+import java.io.Serializable;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -50,6 +51,9 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -57,7 +61,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portalapp.portal.domain.db.fn.FnRole;
+import org.onap.portal.domain.db.fn.FnRole;
 
 /*
 CREATE TABLE `ep_role_notification` (
@@ -74,6 +78,16 @@ CREATE TABLE `ep_role_notification` (
         )
 */
 
+@NamedQueries({
+    @NamedQuery(
+        name = "EpRoleNotification.getNotificationRoles",
+        query = "from\n"
+            + "  EpRoleNotification r\n"
+            + " where\n"
+            + "  r.notificationId.notificationId = :notificationID\n"
+    )
+})
+
 @Table(name = "ep_role_notification", indexes = {
         @Index(name = "ep_notif_recv_user_id_idx", columnList = "recv_user_id"),
         @Index(name = "fk_ep_role_notif_fn_notif", columnList = "notification_ID"),
@@ -84,20 +98,20 @@ CREATE TABLE `ep_role_notification` (
 @Getter
 @Setter
 @Entity
-public class EpRoleNotification {
+public class EpRoleNotification implements Serializable {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "ID", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "notification_ID")
        @Valid
-       private EpNotification notificationID;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_ID")
+       private EpNotification notificationId;
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "role_ID", columnDefinition = "bigint")
        @Valid
-       private FnRole roleID;
+       private FnRole roleId;
        @Column(name = "recv_user_id", length = 11, columnDefinition = "int(11) DEFAULT NULL")
        @Digits(integer = 11, fraction = 0)
        private Long recvUserId;