From b38cdcc65fad5909a42b7a67a63cd66ad2dbe7d4 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Wed, 21 Oct 2020 17:28:51 +0100 Subject: Changing save to saveAndFlush to flush the data to DB immediately and Updating Camunda configuration to use separate transaction manager than other datasources Change-Id: Id621827a9de61dec08c4bae92741fbd7296824a7 Issue-ID: SO-2868 Signed-off-by: waqas.ikram --- .../nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java | 4 ++-- .../etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java | 4 ++-- .../nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java | 4 ++-- .../nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java | 4 ++-- .../nfvo/ns/lcm/database/service/DatabaseServiceProvider.java | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src') diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java index d52dcd6192..d7f2f4cefa 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java @@ -22,16 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.OperationStateEnum; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; /** * @author Waqas Ikram (waqas.ikram@est.tech) * @author mukeshsharma(mukeshsharma@est.tech) */ -public interface NSLcmOpOccRepository extends CrudRepository { +public interface NSLcmOpOccRepository extends JpaRepository { Optional findById(final String id); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java index 2d6d033689..220902c631 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java @@ -21,13 +21,13 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob; -import org.springframework.data.repository.CrudRepository; +import org.springframework.data.jpa.repository.JpaRepository; /** * @author Waqas Ikram (waqas.ikram@est.tech) * */ -public interface NfvoJobRepository extends CrudRepository, RefreshableRepository { +public interface NfvoJobRepository extends JpaRepository, RefreshableRepository { Optional findByResourceId(final String resourceId); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java index 5560ea7af3..f91a85f2e6 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java @@ -23,16 +23,16 @@ import java.util.List; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNfInst; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; /** * @author Waqas Ikram (waqas.ikram@est.tech) * @author mukeshsharma(mukeshsharma@est.tech) */ -public interface NfvoNfInstRepository extends CrudRepository { +public interface NfvoNfInstRepository extends JpaRepository { Optional findByNfInstId(final String nfInstId); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java index 2a6abda558..a64cf9bdd5 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java @@ -22,16 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; /** * @author Waqas Ikram (waqas.ikram@est.tech) * */ -public interface NfvoNsInstRepository extends CrudRepository { +public interface NfvoNsInstRepository extends JpaRepository { Optional findByName(final String name); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java index 58ca76eec9..ec8777d0fa 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java @@ -68,7 +68,7 @@ public class DatabaseServiceProvider { public boolean addJob(final NfvoJob job) { logger.info("Adding NfvoJob: {} to database", job); - return nfvoJobRepository.save(job) != null; + return nfvoJobRepository.saveAndFlush(job) != null; } public Optional getJob(final String jobId) { @@ -104,7 +104,7 @@ public class DatabaseServiceProvider { public boolean saveNfvoNsInst(final NfvoNsInst nfvoNsInst) { logger.info("Saving NfvoNsInst: {} to database", nfvoNsInst); - return nfvoNsInstRepository.save(nfvoNsInst) != null; + return nfvoNsInstRepository.saveAndFlush(nfvoNsInst) != null; } @Transactional(propagation = Propagation.REQUIRES_NEW) @@ -125,7 +125,7 @@ public class DatabaseServiceProvider { public boolean saveNfvoNfInst(final NfvoNfInst nfvoNfInst) { logger.info("Saving NfvoNfInst: {} to database", nfvoNfInst); - return nfvoNfInstRepository.save(nfvoNfInst) != null; + return nfvoNfInstRepository.saveAndFlush(nfvoNfInst) != null; } @Transactional(propagation = Propagation.REQUIRES_NEW) @@ -162,7 +162,7 @@ public class DatabaseServiceProvider { public boolean addNSLcmOpOcc(final NsLcmOpOcc nsLcmOpOcc) { logger.info("Adding NSLcmOpOcc: {} to database", nsLcmOpOcc); - return nsLcmOpOccRepository.save(nsLcmOpOcc) != null; + return nsLcmOpOccRepository.saveAndFlush(nsLcmOpOcc) != null; } @Transactional(propagation = Propagation.REQUIRES_NEW) -- cgit 1.2.3-korg