I'm writing a library that wraps the JpaRepository
interface of Spring Data Jpa
because I want to add the same criteria automatically to all JpaRepository
DB calls (something like and where t > something
).
For example findById
function of JpaRepository
under the hood will be translated to find by id and where t > something
Is it possible? and if so, how do I do it?
Thanks!
A long time ago this was planned, but the team came to the conclusion that it really doesn't seem possible to do it properly. So No, the feature does not exist. See here for details: https://jira.spring.io/browse/DATACMNS-293
There is Hibernates
@Where
and@Filter
though.