Java 17 Upgrade
[policy/models.git] / models-tosca / src / main / java / org / onap / policy / models / tosca / simple / concepts / JpaToscaPolicyType.java
index 8e40384..14502c6 100644 (file)
@@ -3,7 +3,8 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.policy.models.tosca.simple.concepts;
 
+import jakarta.persistence.CollectionTable;
+import jakarta.persistence.ElementCollection;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Inheritance;
+import jakarta.persistence.InheritanceType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.Lob;
+import jakarta.persistence.Table;
+import java.io.Serial;
 import java.util.List;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
@@ -56,12 +61,18 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
 @EqualsAndHashCode(callSuper = true)
 @NoArgsConstructor
 public class JpaToscaPolicyType extends JpaToscaWithToscaProperties<ToscaPolicyType> {
+    @Serial
     private static final long serialVersionUID = -563659852901842616L;
 
     @ElementCollection
+    @CollectionTable(joinColumns = {
+        @JoinColumn(name = "toscaPolicyTypeName",    referencedColumnName = "name"),
+        @JoinColumn(name = "toscaPolicyTypeVersion",    referencedColumnName = "version")
+    })
     private List<@NotNull @Valid PfConceptKey> targets;
 
     @ElementCollection
+    @Lob
     private List<@NotNull @Valid JpaToscaTrigger> triggers;
 
     /**
@@ -95,7 +106,7 @@ public class JpaToscaPolicyType extends JpaToscaWithToscaProperties<ToscaPolicyT
 
     @Override
     public ToscaPolicyType toAuthorative() {
-        ToscaPolicyType toscaPolicyType = new ToscaPolicyType();
+        var toscaPolicyType = new ToscaPolicyType();
         super.setToscaEntity(toscaPolicyType);
         super.toAuthorative();