Fix for JPA getById method deprecation

This commit is contained in:
Jose Alberto Hernandez
2022-07-04 09:28:32 +02:00
committed by Arnold Gálovics
parent 2e0fe6aa90
commit 2d07e8c867
6 changed files with 28 additions and 28 deletions
@@ -65,7 +65,7 @@ public class CreditBureauConfigurationWritePlatformServiceImpl implements Credit
this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureauId);
final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getById(creditBureauId);
final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getReferenceById(creditBureauId);
final CreditBureauConfiguration cb_config = CreditBureauConfiguration.fromJson(command, orgcb);
@@ -68,9 +68,9 @@ public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements C
final long lpid = command.longValueOfParameterNamed("loanProductId");
final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getById(organisationCreditBureauId);
final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getReferenceById(organisationCreditBureauId);
final LoanProduct lp = this.loanProductRepository.getById(lpid);
final LoanProduct lp = this.loanProductRepository.getReferenceById(lpid);
final CreditBureauLoanProductMapping cb_lp = CreditBureauLoanProductMapping.fromJson(command, orgcb, lp);
@@ -88,7 +88,7 @@ public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements C
final Long mappingid = command.longValueOfParameterNamed("creditbureauLoanProductMappingId");
final boolean isActive = command.booleanPrimitiveValueOfParameterNamed("isActive");
final CreditBureauLoanProductMapping cblpmapping = this.creditBureauLoanProductMappingRepository.getById(mappingid);
final CreditBureauLoanProductMapping cblpmapping = this.creditBureauLoanProductMappingRepository.getReferenceById(mappingid);
cblpmapping.setIs_active(isActive);
this.creditBureauLoanProductMappingRepository.saveAndFlush(cblpmapping);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(cblpmapping.getId()).build();
@@ -58,7 +58,7 @@ public class OrganisationCreditBureauWritePlatflormServiceImpl implements Organi
this.context.authenticatedUser();
this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureauId);
final CreditBureau creditBureau = this.creditBureauRepository.getById(creditBureauId);
final CreditBureau creditBureau = this.creditBureauRepository.getReferenceById(creditBureauId);
final OrganisationCreditBureau organisationCreditBureau = OrganisationCreditBureau.fromJson(command, creditBureau);
@@ -78,7 +78,7 @@ public class OrganisationCreditBureauWritePlatflormServiceImpl implements Organi
final boolean isActive = command.booleanPrimitiveValueOfParameterNamed("isActive");
final OrganisationCreditBureau orgcb = organisationCreditBureauRepository.getById(creditbureauID);
final OrganisationCreditBureau orgcb = organisationCreditBureauRepository.getReferenceById(creditbureauID);
orgcb.setIsActive(isActive);
@@ -59,7 +59,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
context.authenticatedUser();
fromApiJsonDeserializer.validateForCreate(jsonObject.toString(), false);
final CodeValue addressTypeIdCodeValue = codeValueRepository.getById(addressTypeId);
final CodeValue addressTypeIdCodeValue = codeValueRepository.getReferenceById(addressTypeId);
final Client client = clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
final Address address = createAddress(jsonObject);
@@ -83,7 +83,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
fromApiJsonDeserializer.validateForCreate(jsonObject.toString(), true);
final long addressTypeId = jsonObject.get("addressTypeId").getAsLong();
final CodeValue addressTypeIdCodeValue = codeValueRepository.getById(addressTypeId);
final CodeValue addressTypeIdCodeValue = codeValueRepository.getReferenceById(addressTypeId);
final Address address = createAddress(jsonObject);
addressRepository.save(address);
@@ -111,13 +111,13 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
CodeValue stateIdCodeValue = null;
if (jsonObject.get("stateProvinceId") != null) {
long stateId = jsonObject.get("stateProvinceId").getAsLong();
stateIdCodeValue = codeValueRepository.getById(stateId);
stateIdCodeValue = codeValueRepository.getReferenceById(stateId);
}
CodeValue countryIdCodeValue = null;
if (jsonObject.get("countryId") != null) {
long countryId = jsonObject.get("countryId").getAsLong();
countryIdCodeValue = codeValueRepository.getById(countryId);
countryIdCodeValue = codeValueRepository.getReferenceById(countryId);
}
final Address address = Address.fromJsonObject(jsonObject, stateIdCodeValue, countryIdCodeValue);
@@ -150,7 +150,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
throw new AddressNotFoundException(clientId);
}
final Address addobj = this.addressRepository.getById(addressId);
final Address addobj = this.addressRepository.getReferenceById(addressId);
if (!command.stringValueOfParameterNamed("addressLine1").isEmpty()) {
@@ -198,7 +198,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
if (command.longValueOfParameterNamed("stateProvinceId") != 0) {
is_address_update = true;
stateId = command.longValueOfParameterNamed("stateProvinceId");
stateIdobj = this.codeValueRepository.getById(stateId);
stateIdobj = this.codeValueRepository.getReferenceById(stateId);
addobj.setStateProvince(stateIdobj);
}
@@ -207,7 +207,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
if (command.longValueOfParameterNamed("countryId") != 0) {
is_address_update = true;
countryId = command.longValueOfParameterNamed("countryId");
countryIdObj = this.codeValueRepository.getById(countryId);
countryIdObj = this.codeValueRepository.getReferenceById(countryId);
addobj.setCountry(countryIdObj);
}
@@ -119,22 +119,22 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
if (command.longValueOfParameterNamed("relationshipId") != null) {
relationshipId = command.longValueOfParameterNamed("relationshipId");
relationship = this.codeValueRepository.getById(relationshipId);
relationship = this.codeValueRepository.getReferenceById(relationshipId);
}
if (command.longValueOfParameterNamed("maritalStatusId") != null) {
maritalStatusId = command.longValueOfParameterNamed("maritalStatusId");
maritalStatus = this.codeValueRepository.getById(maritalStatusId);
maritalStatus = this.codeValueRepository.getReferenceById(maritalStatusId);
}
if (command.longValueOfParameterNamed("genderId") != null) {
genderId = command.longValueOfParameterNamed("genderId");
gender = this.codeValueRepository.getById(genderId);
gender = this.codeValueRepository.getReferenceById(genderId);
}
if (command.longValueOfParameterNamed("professionId") != null) {
professionId = command.longValueOfParameterNamed("professionId");
profession = this.codeValueRepository.getById(professionId);
profession = this.codeValueRepository.getReferenceById(professionId);
}
if (command.dateValueOfParameterNamed("dateOfBirth") != null) {
@@ -218,22 +218,22 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
if (member.get("relationshipId") != null) {
relationshipId = member.get("relationshipId").getAsLong();
relationship = this.codeValueRepository.getById(relationshipId);
relationship = this.codeValueRepository.getReferenceById(relationshipId);
}
if (member.get("maritalStatusId") != null) {
maritalStatusId = member.get("maritalStatusId").getAsLong();
maritalStatus = this.codeValueRepository.getById(maritalStatusId);
maritalStatus = this.codeValueRepository.getReferenceById(maritalStatusId);
}
if (member.get("genderId") != null) {
genderId = member.get("genderId").getAsLong();
gender = this.codeValueRepository.getById(genderId);
gender = this.codeValueRepository.getReferenceById(genderId);
}
if (member.get("professionId") != null) {
professionId = member.get("professionId").getAsLong();
profession = this.codeValueRepository.getById(professionId);
profession = this.codeValueRepository.getReferenceById(professionId);
}
if (member.get("dateOfBirth") != null) {
@@ -295,7 +295,7 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
* command.longValueOfParameterNamed("clientFamilyMemberId"); }
*/
ClientFamilyMembers clientFamilyMember = clientFamilyRepository.getById(familyMemberId);
ClientFamilyMembers clientFamilyMember = clientFamilyRepository.getReferenceById(familyMemberId);
// Client
// client=clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
@@ -337,25 +337,25 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
if (command.longValueOfParameterNamed("relationShipId") != null) {
relationshipId = command.longValueOfParameterNamed("relationShipId");
relationship = this.codeValueRepository.getById(relationshipId);
relationship = this.codeValueRepository.getReferenceById(relationshipId);
clientFamilyMember.setRelationship(relationship);
}
if (command.longValueOfParameterNamed("maritalStatusId") != 0) {
maritalStatusId = command.longValueOfParameterNamed("maritalStatusId");
maritalStatus = this.codeValueRepository.getById(maritalStatusId);
maritalStatus = this.codeValueRepository.getReferenceById(maritalStatusId);
clientFamilyMember.setMaritalStatus(maritalStatus);
}
if (command.longValueOfParameterNamed("genderId") != 0) {
genderId = command.longValueOfParameterNamed("genderId");
gender = this.codeValueRepository.getById(genderId);
gender = this.codeValueRepository.getReferenceById(genderId);
clientFamilyMember.setGender(gender);
}
if (command.longValueOfParameterNamed("professionId") != 0) {
professionId = command.longValueOfParameterNamed("professionId");
profession = this.codeValueRepository.getById(professionId);
profession = this.codeValueRepository.getReferenceById(professionId);
clientFamilyMember.setProfession(profession);
}
@@ -386,7 +386,7 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
ClientFamilyMembers clientFamilyMember = null;
if (clientFamilyMemberId != null) {
clientFamilyMember = clientFamilyRepository.getById(clientFamilyMemberId);
clientFamilyMember = clientFamilyRepository.getReferenceById(clientFamilyMemberId);
clientFamilyRepository.delete(clientFamilyMember);
}
@@ -1788,7 +1788,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveChargeUndoBusinessEvent(loanCharge));
LoanTransaction loanTransactionData = this.loanTransactionRepository.getById(command.entityId());
LoanTransaction loanTransactionData = this.loanTransactionRepository.getReferenceById(command.entityId());
changes.put("principalPortion", loanTransactionData.getPrincipalPortion());
changes.put("interestPortion", loanTransactionData.getInterestPortion(loan.getCurrency()));
changes.put("feeChargesPortion", loanTransactionData.getFeeChargesPortion(loan.getCurrency()));