diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2022-03-21 00:00:03 +0000 |
---|---|---|
committer | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2022-03-22 13:16:48 +0000 |
commit | b66daa5aa2d3fa3645f579bfd7a69ccf5a48be2f (patch) | |
tree | f650459ca535ef4d199f4cf18b0112b95c7c426d /main | |
parent | 2e15dfa79186f731920003abaaa208b4829fe606 (diff) |
Fix spring transaction issue in getNodetemplates
changes on the db service template object gets auto updated to the db
by spring transaction. Creating new object copy to avoid the same.
Issue-ID: POLICY-3934
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I0dbd5cb9d2c1119b2f263f60ed470bc8fef85d1e
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/org/onap/policy/api/main/service/ToscaServiceTemplateService.java | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/main/src/main/java/org/onap/policy/api/main/service/ToscaServiceTemplateService.java b/main/src/main/java/org/onap/policy/api/main/service/ToscaServiceTemplateService.java index d578d0dc..2e8fc9eb 100644 --- a/main/src/main/java/org/onap/policy/api/main/service/ToscaServiceTemplateService.java +++ b/main/src/main/java/org/onap/policy/api/main/service/ToscaServiceTemplateService.java @@ -550,14 +550,13 @@ public class ToscaServiceTemplateService { throws PfModelException { LOGGER.debug("->getNodeTemplate: name={}, version={}", name, version); List<ToscaNodeTemplate> nodeTemplates = new ArrayList<>(); - var jpaNodeTemplates = new JpaToscaNodeTemplates(); var dbServiceTemplate = getDefaultJpaToscaServiceTemplate(); //Return empty if no nodeTemplates present in db if (!ToscaUtils.doNodeTemplatesExist(dbServiceTemplate)) { return nodeTemplates; } - jpaNodeTemplates = dbServiceTemplate.getTopologyTemplate().getNodeTemplates(); + var jpaNodeTemplates = new JpaToscaNodeTemplates(dbServiceTemplate.getTopologyTemplate().getNodeTemplates()); //Filter specific nodeTemplates if (name != null && version != null) { |