From: kuldipr Date: Fri, 17 Jun 2022 16:18:35 +0000 (-0400) Subject: Change template query to return a result when duplicate rows exists X-Git-Tag: 1.4.0~27 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F76%2F129776%2F3;p=ccsdk%2Fcds.git Change template query to return a result when duplicate rows exists Issue-ID: CCSDK-3714 Change-Id: I516efc75d5d789903883437b6f3b50874bcfc79a Signed-off-by: kuldipr --- diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt index 38d61e78d..0d8946ece 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt @@ -24,6 +24,16 @@ import javax.transaction.Transactional @Repository interface TemplateResolutionRepository : JpaRepository { + @Query( + value = """ + SELECT * FROM TEMPLATE_RESOLUTION + WHERE resource_type = :resourceType AND resource_id = :resourceId + AND blueprint_name = :blueprintName AND blueprint_version = :blueprintVersion + AND artifact_name = :artifactName AND occurrence = :occurrence + ORDER BY creation_date DESC LIMIT 1 + """, + nativeQuery = true + ) fun findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence( resourceId: String, resourceType: String, @@ -33,6 +43,15 @@ interface TemplateResolutionRepository : JpaRepository