忽略Hibernate @Where注释 [英] Ignore Hibernate @Where annotation

查看:179
本文介绍了忽略Hibernate @Where注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实体,它与@Where注释的另一个实体有关联,就像这样

I have an Entity which has an association to another Entity annotated with @Where, like so

public class EntityA {

    @OneToMany
    @Where(...)
    private List<EntityB> entityBList;

}

最近发生了不可避免的事情,我需要加载EntityB的不符合@Where条款。我可以删除@Where注释,但它使用了很多,所以理想情况下我不想这样做。除了用另一个查询手动加载EntityB的列表,我有什么选择?我可以告诉Hibernate忽略@Where注解吗?

Recently the inevitable has happened, I need to load EntityB's that don't conform to the @Where clause. I could remove the @Where annotation, but it is used a lot, so ideally I don't want to do that. Apart from loading the list of EntityB's manually, with another query, what are my options? Can I tell Hibernate to ignore the @Where annotation?

推荐答案

经过大量研究,看起来这根本不可能。我强烈建议避免使用@Where,因为如果您需要这些关联或者不需要,预先很难预测。

After lots of research it appears that this is simply impossible. I'd strongly suggest avoiding @Where, as it is hard to predict beforehand if you'll ever need those associations or not.

这篇关于忽略Hibernate @Where注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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