budaidev commented on code in PR #4570:
URL: https://github.com/apache/fineract/pull/4570#discussion_r2056004470


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarInstanceRepository.java:
##########
@@ -45,24 +52,27 @@ public interface CalendarInstanceRepository extends 
JpaRepository<CalendarInstan
      *            {@link CalendarType}
      * @return
      */
+    @Cacheable(key = "T(java.util.Objects).hash(#entityId, #entityTypeId, 
#calendarTypeId)")
     CalendarInstance findByEntityIdAndEntityTypeIdAndCalendarTypeId(Long 
entityId, Integer entityTypeId, Integer calendarTypeId);
 
+    @Cacheable(key = "T(java.util.Objects).hash(#entityId, #entityTypeId)")
     @Query("select ci from CalendarInstance ci where ci.entityId = :entityId 
and ci.entityTypeId = :entityTypeId")
     CalendarInstance findCalendarInstaneByEntityId(@Param("entityId") Long 
entityId, @Param("entityTypeId") Integer entityTypeId);

Review Comment:
   Added an extra seperation for collection and instance type to avoid collision



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarInstanceRepository.java:
##########
@@ -25,15 +25,22 @@
 import org.apache.fineract.portfolio.loanaccount.domain.Loan;
 import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
 import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
 
+@Repository
+@CacheConfig(cacheNames = "calendarInstances")

Review Comment:
   added



-- 
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