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


##########
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:
   Cache eviction here as well? 



##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/ApplicationCurrencyRepository.java:
##########
@@ -28,16 +30,20 @@
 import org.springframework.stereotype.Repository;
 
 @Repository
+@CacheConfig(cacheNames = "currencies")
 public interface ApplicationCurrencyRepository
         extends JpaRepository<ApplicationCurrency, Long>, 
JpaSpecificationExecutor<ApplicationCurrency> {
 
     String FIND_CURRENCY_DETAILS = "SELECT new 
org.apache.fineract.organisation.monetary.data.CurrencyData(ac.code, ac.name, 
ac.decimalPlaces, ac.inMultiplesOf, ac.displaySymbol, ac.nameCode) FROM 
ApplicationCurrency ac ";
 
+    @Cacheable(key = "#currencyCode")
     ApplicationCurrency findOneByCode(String currencyCode);
 
+    @Cacheable(key = "#currencyCode")
     @Query(FIND_CURRENCY_DETAILS + " WHERE ac.code = :code")
     CurrencyData findCurrencyDataByCode(@Param("code") String currencyCode);
 
+    @Cacheable
     @Query(FIND_CURRENCY_DETAILS)
     List<CurrencyData> findAllSorted(Sort sort);

Review Comment:
   If I remember correctly there's a way to add new currencies to the system 
through the UI, so I think the cache eviction is missing from here.



##########
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:
   Isn't this also the same as the second method?



##########
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);

Review Comment:
   Btw isn't this the same as the first method?



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