The following erupts when starting my app:
Code:
net.sf.hibernate.MappingException: bug in initComponentPropertyPaths
at net.sf.hibernate.persister.AbstractPropertyMapping.initComponentPropertyPaths(AbstractPropertyMapping.java:140)
at net.sf.hibernate.persister.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:111)
at net.sf.hibernate.persister.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:80)
at net.sf.hibernate.persister.AbstractEntityPersister.initPropertyPaths(AbstractEntityPersister.java:503)
at net.sf.hibernate.persister.EntityPersister.postInstantiate(EntityPersister.java:112)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:155)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:720)
at com.foobarcompany.Hibertest.Main.main(Main.java:35)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at net.sf.hibernate.util.ArrayHelper.slice(ArrayHelper.java:61)
at net.sf.hibernate.persister.AbstractPropertyMapping.initComponentPropertyPaths(AbstractPropertyMapping.java:135)
... 7 more
Exception in thread "main"
Hibernate is attempting to map properties for the following:
Code:
<class name="com.foobarcompany.Hibertest.orm.LiensCmAlAf" table="liens_cm_al_af" mutable="false">
<id name="id" column="id_customer" type="integer">
<generator class="increment"/>
</id>
<property name="billingId" column="id_af" type="integer"/>
<property name="shippingId" column="id_al" type="integer"/>
<property name="clientCode" column="code_maestria" type="string"/>
<property name="region" column="database_id" type="string"/>
<one-to-one name="shippingXref" class="com.foobarcompany.Hibertest.orm.OwXref"/>
<one-to-one name="billingXref" class="com.foobarcompany.Hibertest.orm.OwXref"/>
</class>
I believe the problem has to do with the fact that OwXref class has a composite key:
Code:
<class name="com.foobarcompany.Hibertest.orm.OwXref" table="ow_xref">
<composite-id name="id" class="com.foobarcompany.Hibertest.orm.OwXrefId">
<property name="type" column="type"/>
<property name="from" column="orig"/>
</composite-id>
<property name="to" column="ow"/>
</class>
ArrayHelper.slice() is called twice during initialization. The two calls have the following parameters:
Code:
String[] strings = { "id_customer" }
begin = 0
length = 1
String[] strings = { "id_customer" }
begin = 1
length = 1
The second call throws the exception because slice() references the 1th index of an array that has only 1 element.
What am I doing wrong?
Thanks.