diff options
author | waqas.ikram <waqas.ikram@est.tech> | 2020-10-21 17:28:51 +0100 |
---|---|---|
committer | waqas.ikram <waqas.ikram@est.tech> | 2020-10-22 13:13:59 +0100 |
commit | b38cdcc65fad5909a42b7a67a63cd66ad2dbe7d4 (patch) | |
tree | 78d034914fe0d26d4bae061903c71fc6c3aad1fb /so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main | |
parent | 506cd385cb845fa334856c0e236a79b058c8eb35 (diff) |
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 <waqas.ikram@est.tech>
Diffstat (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main')
5 files changed, 12 insertions, 12 deletions
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<NsLcmOpOcc, String> { +public interface NSLcmOpOccRepository extends JpaRepository<NsLcmOpOcc, String> { Optional<NsLcmOpOcc> 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<NfvoJob, String>, RefreshableRepository<NfvoJob> { +public interface NfvoJobRepository extends JpaRepository<NfvoJob, String>, RefreshableRepository<NfvoJob> { Optional<NfvoJob> 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<NfvoNfInst, String> { +public interface NfvoNfInstRepository extends JpaRepository<NfvoNfInst, String> { Optional<NfvoNfInst> 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<NfvoNsInst, String> { +public interface NfvoNsInstRepository extends JpaRepository<NfvoNsInst, String> { Optional<NfvoNsInst> 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<NfvoJob> 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) |