是否可以延迟加载 @Formula 注释? [英] Is it possible to make @Formula annotation lazily loaded?

查看:22
本文介绍了是否可以延迟加载 @Formula 注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 @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?

谢谢

推荐答案

是的.只需通过 @Basic(fetch=FetchType.LAZY) 并使用这个 ant task 由 hibernate 提供,用于对实体类进行字节码检测.否则,@Formula 属性的 LAZY 加载将被静默忽略.

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 任务进行字节码检测的信息.

The documentation contains the info on how to use this ant task to do bytecode instrumentation.

这篇关于是否可以延迟加载 @Formula 注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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