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


##########
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:
   I think we should use different keygeneration logic as i think with hash 
calculation we can easily conflict:
   
   `@Cacheable(key = "T(java.util.Objects).hash(#calendarId, #entityId, 
#entityTypeId)")
       CalendarInstance findByCalendarIdAndEntityIdAndEntityTypeId(Long 
calendarId, Long entityId, Integer entityTypeId);`
   vs
   `@Cacheable(key = "T(java.util.Objects).hash(#entityId, #entityTypeId, 
#calendarTypeId)")
       CalendarInstance findByEntityIdAndEntityTypeIdAndCalendarTypeId(Long 
entityId, Integer entityTypeId, Integer calendarTypeId);`
       
   What if:
   - calendarId: 1
   - entityId: 1
   - entityTypeId: 1
   - calendarTypeId: 1
   
   Hash of 1,1,1 and Hash of 1,1,1....



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