Skip to content

Commit

Permalink
putting transaction on EntityManager involved query
Browse files Browse the repository at this point in the history
  • Loading branch information
ndduc01 committed Jan 31, 2025
1 parent 511598c commit 976e50f
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.StoredProcedureQuery;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;

Expand Down Expand Up @@ -37,6 +38,7 @@ public class NbsInterfaceStoredProcRepository {
@PersistenceContext(unitName = "nbsEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public void updateSpecimenCollDateSP(Long nbsInterfaceUid, Timestamp specimentCollectionDate) throws DataProcessingException {
try {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ObservationMatchStoredProcRepository {
@PersistenceContext(unitName = "nbsEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public Long getMatchedObservation(EdxLabInformationDto edxLabInformationDto) throws DataProcessingException {
ObservationContainer observationContainer = edxLabInformationDto.getRootObservationContainer();
String clia = edxLabInformationDto.getSendingFacilityClia();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;
import java.util.ArrayList;
Expand Down Expand Up @@ -71,6 +72,7 @@ public CustomAuthUserRepositoryImpl() {
// For Unit Test
}

@Transactional
public Collection<AuthUserRealizedRole> getAuthUserRealizedRole(String userId) {
Query query = entityManager.createNativeQuery(SELECT_REALIZED_ROLES_FOR_USER_ID);
Collection<AuthUserRealizedRole> authUserRealizedRoles = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -53,6 +54,7 @@ public CustomNbsQuestionRepositoryImpl() {
// For Unit Test
}

@Transactional
public Collection<QuestionRequiredNnd> retrieveQuestionRequiredNnd(String formCd) {
Query query = entityManager.createNativeQuery(NND_UI_META_DATA_BY_FORM_CODE);
query.setParameter("investigationFormCode", formCd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.sql.Timestamp;
Expand Down Expand Up @@ -59,6 +60,7 @@ public CustomRepositoryImpl(PublicHealthCaseStoredProcRepository publicHealthCas
this.publicHealthCaseStoredProcRepository = publicHealthCaseStoredProcRepository;
}

@Transactional
public List<StateDefinedFieldDataDto> getLdfCollection(Long busObjectUid, String conditionCode, String theQuery) {
Query query = entityManager.createNativeQuery(theQuery);
query.setParameter("businessObjUid", busObjectUid);
Expand All @@ -82,6 +84,7 @@ public List<StateDefinedFieldDataDto> getLdfCollection(Long busObjectUid, String
return lst;
}

@Transactional
public Map<Object, Object> getAssociatedDocumentList(Long uid, String targetClassCd, String sourceClassCd, String theQuery) {
Map<Object, Object> map= new HashMap<> ();
Query query = entityManager.createNativeQuery(theQuery);
Expand All @@ -96,6 +99,8 @@ public Map<Object, Object> getAssociatedDocumentList(Long uid, String targetClas
}
return map;
}

@Transactional
public Map<String, EDXEventProcessDto>getEDXEventProcessMapByCaseId(Long publicHealthCaseUid) {
String docQuery = " SELECT"
+ " edx_event_process_uid \"eDXEventProcessUid\", "
Expand Down Expand Up @@ -136,6 +141,7 @@ public Map<Object, Object> getAssociatedDocumentList(Long uid, String targetClas
}


@Transactional
public Map<Object, Object> retrieveDocumentSummaryVOForInv(Long publicHealthUID) {
Map<Object,Object> map= new HashMap<> ();
Query query = entityManager.createNativeQuery(DOCUMENT_FOR_A_PHC);
Expand All @@ -160,6 +166,7 @@ public Map<Object, Object> retrieveDocumentSummaryVOForInv(Long publicHealthUID)
return map;
}

@Transactional
public List<NotificationSummaryContainer> retrieveNotificationSummaryListForInvestigation(Long publicHealthUID, String theQuery) {
List<NotificationSummaryContainer> map= new ArrayList<> ();
Query query = entityManager.createNativeQuery(theQuery);
Expand Down Expand Up @@ -192,6 +199,7 @@ public List<NotificationSummaryContainer> retrieveNotificationSummaryListForInve
return map;
}

@Transactional
public Map<Object, Object> retrieveTreatmentSummaryVOForInv(Long publicHealthUID, String theQuery) {
Map<Object,Object> map= new HashMap<> ();
Query query = entityManager.createNativeQuery(theQuery);
Expand All @@ -214,6 +222,7 @@ public Map<Object, Object> retrieveTreatmentSummaryVOForInv(Long publicHealthUID
return map;
}

@Transactional
public Map<Object,Object> getAssociatedInvList(Long uid,String sourceClassCd, String theQuery) {
Map<Object,Object> assocoiatedInvMap= new HashMap<> ();
Query query = entityManager.createNativeQuery(theQuery);
Expand All @@ -232,6 +241,7 @@ public Map<Object,Object> getAssociatedInvList(Long uid,String sourceClassCd, S
return assocoiatedInvMap;
}

@Transactional
public ArrayList<ResultedTestSummaryContainer> getSusceptibilityResultedTestSummary(String typeCode, Long observationUid) {
String theSelect = SELECT_LABSUSCEPTIBILITES_REFLEXTEST_SUMMARY_FORWORKUP_SQLSERVER;
Query query = entityManager.createNativeQuery(theSelect);
Expand Down Expand Up @@ -268,6 +278,7 @@ public ArrayList<ResultedTestSummaryContainer> getSusceptibilityResultedTestSumm
return lst;
}

@Transactional
public ArrayList<UidSummaryContainer> getSusceptibilityUidSummary(ResultedTestSummaryContainer rvo, LabReportSummaryContainer labRepEvent, LabReportSummaryContainer labRepSumm, String typeCode, Long observationUid)
{
String theSelect = GET_SOURCE_ACT_UID_FOR_SUSCEPTIBILITES_SQL;
Expand All @@ -286,6 +297,7 @@ public ArrayList<UidSummaryContainer> getSusceptibilityUidSummary(ResultedTestSu
return lst;
}

@Transactional
public ArrayList<ResultedTestSummaryContainer> getTestAndSusceptibilities(String typeCode, Long observationUid, LabReportSummaryContainer labRepEvent, LabReportSummaryContainer labRepSumm) {
String theSelect = SELECT_LABRESULTED_REFLEXTEST_SUMMARY_FORWORKUP_SQL;
Query query = entityManager.createNativeQuery(theSelect);
Expand Down Expand Up @@ -323,6 +335,7 @@ public ArrayList<ResultedTestSummaryContainer> getTestAndSusceptibilities(String
return lst;
}

@Transactional
public ProviderDataForPrintContainer getOrderingPersonPhone(ProviderDataForPrintContainer providerDataForPrintVO, Long organizationUid) {
String theSelect = "select phone_nbr_txt \"phoneNbrTxt\", extension_txt \"extensionTxt\" from TELE_locator with (nolock) where TELE_locator_uid in ("
+" select locator_uid from Entity_locator_participation with (nolock) where entity_uid= "+ organizationUid + " and cd='O' and class_cd='TELE') ";
Expand All @@ -337,6 +350,8 @@ public ProviderDataForPrintContainer getOrderingPersonPhone(ProviderDataForPrint
}
return providerDataForPrintVO;
}

@Transactional
public ProviderDataForPrintContainer getOrderingPersonAddress(ProviderDataForPrintContainer providerDataForPrintVO, Long organizationUid)
{
String theSelect = "select street_addr1 \"streetAddr1\", city_desc_txt \"cityDescTxt\", state_cd \"stateCd\", zip_cd \"zipCd\" from Postal_locator with (nolock) where postal_locator_uid in ("
Expand All @@ -354,6 +369,8 @@ public ProviderDataForPrintContainer getOrderingPersonAddress(ProviderDataForPri
}
return providerDataForPrintVO;
}

@Transactional
public ProviderDataForPrintContainer getOrderingFacilityPhone(ProviderDataForPrintContainer providerDataForPrintVO, Long organizationUid)
{
String theSelect = "select phone_nbr_txt \"phoneNbrTxt\", extension_txt \"extensionTxt\" from TELE_locator with (nolock) where TELE_locator_uid in ("
Expand All @@ -369,6 +386,8 @@ public ProviderDataForPrintContainer getOrderingFacilityPhone(ProviderDataForPri
}
return providerDataForPrintVO;
}

@Transactional
public ProviderDataForPrintContainer getOrderingFacilityAddress(ProviderDataForPrintContainer providerDataForPrintVO, Long organizationUid)
{

Expand All @@ -390,6 +409,7 @@ public ProviderDataForPrintContainer getOrderingFacilityAddress(ProviderDataForP
return providerDataForPrintVO;
}

@Transactional
public String getSpecimanSource(Long materialUid) {
String vals = null;
String theSelect = "SELECT cd \"specimenSource\" "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class Observation_SummaryRepositoryImpl implements Observation_SummaryRep
"AND person_parent_uid = :personParentUid";


@Transactional
@Override
public Collection<Observation_Summary> findAllActiveLabReportUidListForManage(Long investigationUid, String whereClause) {
var sql = findAllActiveLabReportUidListForManage_SQL + whereClause;
Expand All @@ -92,6 +93,7 @@ public Collection<Observation_Summary> findAllActiveLabReportUidListForManage(Lo
return lst;
}

@Transactional
@Override
public Optional<Collection<Observation_Lab_Summary_ForWorkUp_New>> findLabSummaryForWorkupNew(Long personParentUid, String whereClause) {
var sql = SELECT_LABSUMMARY_FORWORKUPNEW + whereClause;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class EdxPatientMatchStoredProcRepository {
@PersistenceContext(unitName = "odseEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public EdxPatientMatchDto getEdxPatientMatch(String typeCd, String matchString) throws DataProcessingException {
EdxPatientMatchDto edxPatientMatchDto = new EdxPatientMatchDto();

Expand Down Expand Up @@ -74,6 +75,7 @@ public EdxPatientMatchDto getEdxPatientMatch(String typeCd, String matchString)
}


@Transactional
public EdxEntityMatchDto getEdxEntityMatch(String typeCd, String matchString) throws DataProcessingException {
EdxEntityMatchDto edxEntityMatchDto = new EdxEntityMatchDto();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;

Expand Down Expand Up @@ -40,6 +41,7 @@ public class ParticipationStoredProcRepository {
@PersistenceContext(unitName = "odseEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public void insertParticipation(ParticipationDto participationDto) {
try {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.StoredProcedureQuery;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;

Expand Down Expand Up @@ -37,6 +38,7 @@ public class PrepareEntityStoredProcRepository {
@PersistenceContext(unitName = "odseEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public PrepareEntity getPrepareEntity(String businessTriggerCd, String moduleCd, Long uid, String tableName) throws DataProcessingException {
PrepareEntity entity = new PrepareEntity();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.StoredProcedureQuery;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -41,6 +42,7 @@ public class ProgAreaSnomeCodeStoredProcRepository {
@PersistenceContext(unitName = "odseEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public Map<String, Object> getSnomed(String code, String type, String clia) throws DataProcessingException {
Map<String, Object> map = new HashMap<>();
try {
Expand Down Expand Up @@ -77,6 +79,7 @@ public Map<String, Object> getSnomed(String code, String type, String clia) thro
}


@Transactional
public Map<String, Object> getProgAreaCd(String code, String type, String clia) throws DataProcessingException {
Map<String, Object> map = new HashMap<>();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class PublicHealthCaseStoredProcRepository {
@PersistenceContext(unitName = "odseEntityManagerFactory") // Specify the persistence unit name
private EntityManager entityManager;

@Transactional
public Collection<PublicHealthCaseDto> associatedPublicHealthCaseForMprForCondCd(Long mprUid, String conditionCode) throws DataProcessingException {
Collection<PublicHealthCaseDto> models = new ArrayList<>();
try {
Expand Down Expand Up @@ -159,6 +160,7 @@ public Collection<PublicHealthCaseDto> associatedPublicHealthCaseForMprForCondCd

}

@Transactional
public Map<String, EDXEventProcessDto> getEDXEventProcessMap(Long nbsDocumentUid) throws DataProcessingException {
Map<String, EDXEventProcessDto> eventProcessMap = new HashMap<>();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -40,6 +41,7 @@ public class SrteCustomRepositoryImpl implements SrteCustomRepository{


//THIS ONE IS FOR CACHING
@Transactional
public List<LabResult> getAllLabResultJoinWithLabCodingSystemWithOrganismNameInd() {
String codeSql =
"Select Lab_result.LAB_RESULT_CD , lab_result_desc_txt FROM "
Expand Down

0 comments on commit 976e50f

Please sign in to comment.