gavin wrote:
Did you run the bytecode enhancer?? I am sure this is in the docs...
Sorry, I was convinced that Hibernate only uses runtime bytecode manipulation ... OK, my fault. But this is what happend with enhanced code:
java.lang.ArrayIndexOutOfBoundsException: 0
at org.hibernate.persister.BasicEntityPersister.createSelect(BasicEntityPersister.java:2022)
at org.hibernate.persister.BasicEntityPersister.renderSelect(BasicEntityPersister.java:2060)
at org.hibernate.persister.BasicEntityPersister.generateLazySelectString(BasicEntityPersister.java:551)
at org.hibernate.persister.BasicEntityPersister.postInstantiate(BasicEntityPersister.java:2118)
at org.hibernate.persister.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:367)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:200)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:914)
at nabor.Main.showMappingInfo(Main.java:87)
at nabor.Main.init(Main.java:80)
at nabor.Main.main(Main.java:223)
My mapping looks like this:
<hibernate-mapping>
<class name="LazyTest" table="lazy_tests">
<id name="ltId" unsaved-value="null" access="field">
<generator class="sequence">
<param name="sequence">lazy_test_id_seq</param>
</generator>
</id>
<property name="name" access="field"/>
<property name="description" lazy="true" access="field"/>
</class>
</hibernate-mapping>
In debbuger I can see, that SingleTableEntityPersister.subclassFormulaTableNumberClosure is 0-length array.
However subclassPropertyFormulaNumberClosure is an array of 1-legth int arrays. subclassFormulaTableNumberClosure is iterated in createSelect() according to array collected in generateLazySelectString() using subclassPropertyFormulaNumberClosure field, which causes an exception. I hope that it helps.
PG