【问题标题】:Automatically Add criteria on each Spring Jpa Repository call在每个 Spring Jpa Repository 调用上自动添加标准
【发布时间】:2018-05-24 21:29:44
【问题描述】:

我正在编写一个包装Spring Data JpaJpaRepository 接口的库,因为我想自动将相同的条件添加到所有JpaRepository DB 调用(类似于and where t > something)。

例如 JpaRepository 底层的 findById 函数将转换为 find by id and where t > something

有可能吗?如果是这样,我该怎么做?

谢谢!

【问题讨论】:

  • 使用休眠的@Filter 或简单的@Where

标签: java spring spring-data spring-data-jpa jpql


【解决方案1】:

很久以前就计划好了,但团队得出的结论是,似乎真的不可能正确地做到这一点。所以不,该功能不存在。详情见这里:https://jira.spring.io/browse/DATACMNS-293

不过有Hibernates @Where@Filter

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-30
    • 2015-07-26
    • 1970-01-01
    • 2019-03-29
    • 1970-01-01
    • 2014-08-31
    • 2015-07-14
    • 2013-04-17
    相关资源
    最近更新 更多