在每个Spring Jpa存储库调用上自动添加条件 [英] Automatically Add criteria on each Spring Jpa Repository call

查看:139
本文介绍了在每个Spring Jpa存储库调用上自动添加条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个包装 JpaRepository 接口的库 Spring Data Jpa ,因为我想添加相同的标准自动适用于所有 JpaRepository 数据库调用(类似,其中t>某些东西)。

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

例如 findById 功能 JpaRepository 引擎盖下将被翻译为按ID查找,其中t>

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?

谢谢!

推荐答案

<很久以前,这是有计划的,但团队得出的结论是,它似乎不可能正确地做到这一点。所以不,该功能不存在。有关详细信息,请参阅此处: https://jira.spring.io/browse/DATACMNS-293

Hibernates @Where @Filter 但是。

这篇关于在每个Spring Jpa存储库调用上自动添加条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆