在每个 Spring Jpa 存储库调用上自动添加条件
Automatically Add criteria on each Spring Jpa Repository call
我正在编写一个库来包装 Spring Data Jpa
的 JpaRepository
接口,因为我想自动将相同的条件添加到所有 JpaRepository
数据库调用(类似于 and where t > something
).
例如,JpaRepository
的 findById
函数在后台将被转换为 find by id and where t > something
可能吗?如果可以,我该怎么做?
谢谢!
很久以前就计划好了,但团队得出的结论是,似乎真的不可能正确地做到这一点。所以不,该功能不存在。详情请看这里:https://jira.spring.io/browse/DATACMNS-293
虽然有Hibernates @Where
and @Filter
。
我正在编写一个库来包装 Spring Data Jpa
的 JpaRepository
接口,因为我想自动将相同的条件添加到所有 JpaRepository
数据库调用(类似于 and where t > something
).
例如,JpaRepository
的 findById
函数在后台将被转换为 find by id and where t > something
可能吗?如果可以,我该怎么做?
谢谢!
很久以前就计划好了,但团队得出的结论是,似乎真的不可能正确地做到这一点。所以不,该功能不存在。详情请看这里:https://jira.spring.io/browse/DATACMNS-293
虽然有Hibernates @Where
and @Filter
。