Some time ago I set up some lazy initialized @ManyToOne relationships. At that time I was using the
Code:
org.hibernate.tool.instrument.cglib.InstrumentTask
I was on JBoss 4.2.3 and this worked fine.
I switched to
Code:
org.hibernate.tool.instrument.javassist.InstrumentTask
when I upgraded to JBoss 6.1.0 final.
Per HHH-5451 support for cglib as a bytecode provider has been deprecated.
After noticing some performance problems, I found that this is not longer working. Below is my ant task for the instrumentation.
Code:
<target name="instrument" depends="compile">
<taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask" >
<classpath refid="build.classpath"/>
</taskdef>
<instrument verbose="true">
<fileset dir="${jar.dir}/com/model">
<include name="**/*.class" />
</fileset>
</instrument>
</target>
The class files generated are larger when I instrument and if I display the contents of the .class file I can see that the javassist hooks have been added. I also verified that the classes inside the jar deployed inside my ear have been instrumented.
However, when running the application everything is eagerly loaded.
This is how I annotated my classes.
Code:
private State state;
@ManyToOne(fetch=FetchType.LAZY, optional=false)
public State getState() { return this.state; }
public void setState(State state) { this.state = state; }
I only recently addeed optional=false, but this made no difference.
I am not sure when this stopped working, but I figure it was when I upgraded JBoss and Hibernate several months ago. My application is now at a crawl.
I found this JIRA
https://hibernate.onjira.com/browse/HHH-1435,but it show fixed many versions ago.
I would greatly appreciate any advice on how to debug this or hopefully an easy solution.