infobip-spring-data-querydsl icon indicating copy to clipboard operation
infobip-spring-data-querydsl copied to clipboard

hibernate 2nd cache with predicate findAll

Open tianyu94 opened this issue 2 years ago • 2 comments

@NoRepositoryBean
public interface ExtendedCommonEntityDataPolicyDao<
    T extends AbstractPersistableEntity, Q extends EntityPath<?>
>
    extends ExtendedQuerydslJpaRepository<T, Long>, QuerydslBinderCustomizer<Q> {
// ...
}
@Repository
@Primary
public interface SysGrpDao extends ExtendedCommonEntityDataPolicyDao<SysGrp, QSysGrp> {
    /* Query */
}

findAll method not hint 2nd cache.

but Spring's findById it working.

@QueryHints(@QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true"))
default Page<T> policyFindAll(@Nonnull Pageable pageable) {
    return findAll(pageable);
}

not working even with @QueryHints

tianyu94 avatar May 24 '22 04:05 tianyu94

I must admit I haven't used 2nd level cache in the past so I'll have to spend time digging regarding this one. Do you by any chance have time to create a test repo that reproduces the issue?

lpandzic avatar May 31 '22 07:05 lpandzic

@tianyu94 it'd greatly help if you could provide a small project that reproduces the issue.

lpandzic avatar Aug 29 '22 06:08 lpandzic