Hibernate在整个Spring Boot应用程序上设置属性访问策略 [英] Hibernate set property access strategy on whole Spring Boot application
本文介绍了Hibernate在整个Spring Boot应用程序上设置属性访问策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hibernate提供了两种访问策略:FIELD和PROPERTY.可以通过在实体上方设置注释 @Access
来定义它,但是每次在实施过程中使用策略设置 @Access
都会有些令人沮丧.有什么方法可以在整个应用程序上将访问策略设置为全局"吗?
as I know Hibernate provides two access strategy: FIELD and PROPERTY. It is possible to define it by setting anotation @Access
above entity, but it is a little bit frustrating to set every time @Access
with strategy during implementation. Is there any way to set access strategy "global" on the whole of application?
推荐答案
默认情况下,我认为Spring Boot中不存在这样的属性.
I don't think such a property exists in Spring Boot by default.
但是,您可以为所有实体创建一个父类,以在类级别一次定义 @AccessType
.
However, you can create a parent class for all your entities to define @AccessType
at the class level just once.
文档
查看全文