问题描述
我用 @Formula
注释用它获取计算性能。我需要的是,这些领域/干将被注解为 @Formula
标注应延迟加载。
I have used @Formula
annotation to use it for getting calculated properties. What I need is that those fields/getters which is annotated with @Formula
annotation should be lazily loaded.
这甚至可能如果又如何?
Is this even possible and if so how?
感谢
推荐答案
是的。只是注释字段通过的,并使用该 Ant任务由Hibernate提供以做实体类的字节code仪器。否则,对于 @Formula
属性延迟加载忽略。
Yes . Just annotating the fields/getter of the @Formula
property by @Basic(fetch=FetchType.LAZY) and use this ant task provided by hibernate to do the bytecode instrumentation for the entity class. Otherwise , LAZY loading for the @Formula
property is silently ignored.
的文档包含如何使用此ant任务做字节code仪表的信息。
The documentation contains the info on how to use this ant task to do bytecode instrumentation.
这篇关于是否有可能使@Formula注释延迟加载的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!