adamsaghy commented on code in PR #4570:
URL: https://github.com/apache/fineract/pull/4570#discussion_r2058258809
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarInstanceRepository.java:
##########
@@ -25,15 +25,23 @@
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.CacheEvict;
+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")
public interface CalendarInstanceRepository extends
JpaRepository<CalendarInstance, Long>,
JpaSpecificationExecutor<CalendarInstance> {
+ @Cacheable(key = "T(java.util.Objects).hash(#calendarId, #entityId,
#entityTypeId)")
CalendarInstance findByCalendarIdAndEntityIdAndEntityTypeId(Long
calendarId, Long entityId, Integer entityTypeId);
Review Comment:
I think the default key generation or using a string-composed key would be
more practical here. I know hash collision is rare, but is it worth risking it?
--
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]