你如何以编程方式关闭休眠提取? [英] How do you programmatically turn off eager fetching with hibernate?

查看:115
本文介绍了你如何以编程方式关闭休眠提取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在映射中有一个关联到一个热切加载的集合(lazy =falsefetch =subselect)。如何在编程时使用Hibernate以编程方式关闭它?

I have in my mapping an association to an eagerly loaded collection (lazy="false" fetch="subselect"). How can I turn that off programmatically with Hibernate when I do a query?

推荐答案

事实上,它应该是另一个方式。您可以在映射中将其关闭,并在特定用例中通过查询中的获取来激活它。

In fact, it is supposed to be the other way around. You turn it off in the mapping, and activate it on specific use cases with a "fetch" in the query.

这就是Hibernate团队看到它的方式。 Hibernate没有办法为一个属性创建一个指定no-fetch的请求...

That's the way the Hibernate team sees it. There is no way in Hibernate to create a request that specifies "no-fetch" for a property...

这篇关于你如何以编程方式关闭休眠提取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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