adamsaghy commented on code in PR #2783: URL: https://github.com/apache/fineract/pull/2783#discussion_r1039287147
########## fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientRepository.java: ########## @@ -29,4 +29,35 @@ interface ClientRepository extends JpaRepository<Client, Long>, JpaSpecification @Query(FIND_CLIENT_BY_ACCOUNT_NUMBER) Client getClientByAccountNumber(@Param("accountNumber") String accountNumber); + + @Query(""" + SELECT client.id + FROM Client client + WHERE client.externalId = :externalId + """) + Long getClientIdByExternalId(String externalId); + + @Query(""" + SELECT client + FROM Client client + JOIN client.office office + LEFT JOIN client.transferToOffice transferToOffice + WHERE client.id = :clientId + AND (office.hierarchy LIKE :officeHierarchy OR transferToOffice.hierarchy LIKE :transferToOfficeHierarchy) + """) + Client fetchByClientIdAndHierarchy(Long clientId, String officeHierarchy, String transferToOfficeHierarchy); + + @Query(""" Review Comment: We dont need this. We should not fetch any data by the externalid, rather fetch the client id by the external id and leave untouched the rest of the logic to avoid duplications -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org