-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: bug in initComponentPropertyPaths
PostPosted: Mon Dec 08, 2003 2:11 pm 
Newbie

Joined: Mon Dec 08, 2003 1:54 pm
Posts: 4
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 2:18 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
both side of the one-to-one mapping must have the same id value. Obviously not your case.
The other way is to use the proeprty-ref attribute in hibernate 2.1 (see the doc).

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 2:25 pm 
Newbie

Joined: Mon Dec 08, 2003 1:54 pm
Posts: 4
Merci!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.