Replace Eclipselink with Hibernate
[policy/models.git] / models-interactions / model-impl / guard / src / main / java / org / onap / policy / guard / OperationsHistory.java
index 0e66217..aee57f1 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021,2023 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,22 +28,31 @@ import java.util.Date;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.Table;
+import javax.persistence.TableGenerator;
 import lombok.Data;
 
 @Entity
 @Table(name = "operationshistory", indexes = {
-                @Index(name = "operationshistory_clreqid_index", columnList = "requestId,closedLoopName"),
-                @Index(name = "operationshistory_target_index", columnList = "target,operation,actor,endtime")})
+    @Index(name = "operationshistory_clreqid_index", columnList = "requestId,closedLoopName"),
+    @Index(name = "operationshistory_target_index", columnList = "target,operation,actor,endtime")
+})
 @Data
 public class OperationsHistory implements Serializable {
 
     private static final long serialVersionUID = -551420180714993577L;
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.TABLE, generator = "opHistoryIdGen")
+    @TableGenerator(
+        name = "opHistoryIdGen",
+        table = "ophistory_id_sequence",
+        pkColumnName = "SEQ_NAME",
+        valueColumnName = "SEQ_COUNT",
+        pkColumnValue = "SEQ_GEN")
     @Column(name = "id")
     private Long id;