from hibernate docs, we know that in certain case, for lazy-loading to work, we need build-time instrumentation:
How to stop Hibernate from eagerly fetching many-to-one associated object one-associated-object
so I did the following:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<configuration>
<tasks>
<taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
<classpath>
<path refid="maven.runtime.classpath" />
<path refid="maven.plugin.classpath" />
</classpath>
</taskdef>
<instrument verbose="true">
<fileset dir="target/classes">
<include name="**/*.class" />
</fileset>
</instrument>
</tasks>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
but it gave errors
java.lang.VerifyError: (class: com/mycompany/dao/UserDaoHibernateImpl$2, method: signature: (Lcom/mycompany/dao/UserDaoHibernateImpl;II)V) Expecting to find object/array on stack
this is definitely due to the instrumentation above, since removing it fixes the problem; also websearches also show that this is somehow related to bugs in javaasist and conflicts between spring and hibernate versions.
I'm using hibernate 3.5.6-Final, Spring 3.0.6-RELEASE
I have tried all combinations of javassist versions, and tried changing javassist to asm, with various versions too, but the problem still exists.
Thanks Yang