Avn*_*evy 17 java performance orm hibernate jpa
我有一个大约3000个实体的应用程序(我知道它很多,但我不能改变它).当应用程序加载时,需要Hibernate一分钟来完成所有的工具和SessionFactory设置.
我想知道我是否可以配置Hibernate在构建期间对原始类进行检测.
这样我就可以避免3000个额外生成的代理类以及应用程序启动时的巨大开销.
我已经找到了一些关于Hibernate构建时间检测(org.hibernate.tool.instrument.javassist.InstrumentTask)的信息,但不清楚这是否完全取代了运行时检测或仅处理Hibernate延迟属性提取机制.
任何有关如何将代理生成移动到构建时间的信息将不胜感激.
Ste*_*ole 12
是的你可以.Hibernate代码中有一个Ant任务:org.hibernate.tool.instrument.javassist.InstrumentTask.
<target name="instrument" depends="compile">
<taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
<classpath refid="<some-ant-path-including-hibernate-core-jar>"/>
<classpath path="<your-classes-path>"/>
</taskdef>
<instrument verbose="true">
<fileset dir="<your-classes>">
<include name="*.class"/>
</fileset>
</instrument>
</target>
Run Code Online (Sandbox Code Playgroud)
我也看过一些基于Maven的.
| 归档时间: |
|
| 查看次数: |
5194 次 |
| 最近记录: |