mariiaKraievska commented on code in PR #3854:
URL: https://github.com/apache/fineract/pull/3854#discussion_r1585195289


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountAssociationsReadPlatformServiceImpl.java:
##########
@@ -18,86 +18,101 @@
  */
 package org.apache.fineract.portfolio.account.service;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
+import static java.util.stream.Collectors.toList;
+
+import com.querydsl.core.Tuple;
+import com.querydsl.core.types.dsl.BooleanExpression;
+import com.querydsl.core.types.dsl.SimpleExpression;
+import com.querydsl.jpa.impl.JPAQuery;
+import jakarta.persistence.EntityManager;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
 import org.apache.fineract.portfolio.account.data.AccountAssociationsData;
 import org.apache.fineract.portfolio.account.data.PortfolioAccountData;
 import org.apache.fineract.portfolio.account.domain.AccountAssociationType;
+import org.apache.fineract.portfolio.account.domain.QAccountAssociations;
 import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanaccount.domain.QLoan;
+import org.apache.fineract.portfolio.savings.domain.QSavingsAccount;
 import org.apache.fineract.portfolio.savings.domain.SavingsAccountStatusType;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 @RequiredArgsConstructor
 @Slf4j
 public class AccountAssociationsReadPlatformServiceImpl implements 
AccountAssociationsReadPlatformService {
 
-    private final JdbcTemplate jdbcTemplate;
+    private final EntityManager entityManager;
 
+    @Transactional(propagation = Propagation.REQUIRES_NEW)

Review Comment:
   Thank you for your comments and concerns regarding the use of @Transactional 
with Propagation.REQUIRES_NEW for read-only operations. Initially, this 
approach was adopted to manage specific issues with OptimisticLockException 
observed when using QueryDSL instead of JdbcTemplate. However, improvements 
made in the handling of OptimisticLockException by the recent updates 
https://github.com/apache/fineract/pull/3761 have resolved these issues 
effectively. As a result, the additional transactional annotation is no longer 
necessary, and our tests confirm that the system performs well without it. I 
appreciate your input and agree that adhering to these updated practices 
ensures cleaner and more efficient code.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to