[ 
https://issues.apache.org/jira/browse/FINERACT-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17130047#comment-17130047
 ] 

Petri Tuomola commented on FINERACT-995:
----------------------------------------

I think here's the "guilty" method in 
LoanArrearsAgingServiceImpl.OriginalScheduleExtractor - see line in bold. 

Given that MySQL Connector does not support scrollable cursors, this would need 
to be rewritten to avoid rs.previous().

Looks like all it is trying to do is to merge periods from multiple loans with 
the same ID. So shouldn't be that hard to fix...
{quote}@Override
 public Map<Long, List<LoanSchedulePeriodData>> extractData(ResultSet rs) 
throws SQLException, DataAccessException {
 Map<Long, List<LoanSchedulePeriodData>> scheduleDate = new HashMap<>();

while (rs.next()) {
 Long loanId = rs.getLong("loanId");
 List<LoanSchedulePeriodData> periodDatas = new ArrayList<>();
 LoanSchedulePeriodData loanSchedulePeriodData = 
fetchLoanSchedulePeriodData(rs);
 periodDatas.add(loanSchedulePeriodData);
 while (rs.next()) {
 Long tempLoanId = rs.getLong("loanId");
 if (loanId.equals(tempLoanId)) {
 periodDatas.add(fetchLoanSchedulePeriodData(rs));
 } else {
 *rs.previous();*
 break;
 }
 }
 scheduleDate.put(loanId, periodDatas);
 }

return scheduleDate;
 }
{quote}
 

 

> Operation not allowed for a result set of type ResultSet.TYPE_FORWARD_ONLY
> --------------------------------------------------------------------------
>
>                 Key: FINERACT-995
>                 URL: https://issues.apache.org/jira/browse/FINERACT-995
>             Project: Apache Fineract
>          Issue Type: Bug
>    Affects Versions: 1.4.0
>            Reporter: Michael Vorburger
>            Assignee: Yemdjih Kaze Nasser
>            Priority: Blocker
>             Fix For: 1.4.0
>
>
> See FINERACT-932 for general background. This should definitely be "fixed":
> {noformat}org.quartz.SchedulerException: Job threw an unhandled exception.
>       at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
>       at 
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> Caused by: 
> org.springframework.scheduling.quartz.JobMethodInvocationFailedException: 
> Invocation of method 'updateLoanArrearsAgeingDetails' on target class [class 
> org.apache.fineract.portfolio.loanaccount.service.LoanArrearsAgingServiceImpl$$EnhancerBySpringCGLIB$$f1072374]
>  failed; nested exception is 
> org.springframework.dao.TransientDataAccessResourceException: 
> StatementCallback; SQL [select ml.id as loanId, mr.duedate as dueDate, 
> mr.principal_amount as principalAmount, mr.interest_amount as interestAmount, 
> mr.fee_charges_amount as feeAmount, mr.penalty_charges_amount as 
> penaltyAmount  from m_loan ml  INNER JOIN m_loan_repayment_schedule_history 
> mr on mr.loan_id = ml.id where mr.duedate  < SUBDATE(CURDATE(),INTERVAL  
> ifnull(ml.grace_on_arrears_ageing,0) day) and ml.id IN(8, 9) and  mr.version 
> = (select max(lrs.version) from m_loan_repayment_schedule_history lrs where 
> mr.loan_id = lrs.loan_id) order by ml.id,mr.duedate]; Operation not allowed 
> for a result set of type ResultSet.TYPE_FORWARD_ONLY.; nested exception is 
> java.sql.SQLException: Operation not allowed for a result set of type 
> ResultSet.TYPE_FORWARD_ONLY.
>       at 
> org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:276)
>       at 
> org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
>       at org.quartz.core.JobRunShell.run(JobRunShell.java:202){noformat}
> As per FINERACT-932, this happened on Fineract.dev, which runs with the MySQL 
> JDBC thin driver that is part of our Docker image. It's possible that this is 
> related to a specific JDBC Driver, and cannot be reproduced with Drizzle. 
> IMHO we should consider FINERACT-982 (which won't fix this, but perhaps make 
> it appear in integration testing already; worth a try at least).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to