-->
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.  [ 2 posts ] 
Author Message
 Post subject: null index column for collection
PostPosted: Tue Oct 05, 2004 2:00 pm 
Newbie

Joined: Sun Sep 26, 2004 11:36 am
Posts: 7
Can anyone shed any light on this ? (Ive tried setting inverse=true / false) still no luck. I create a organisation object, create a user object, setOrganisation(org) on the user object. The user is added, so is the organisation but no association is made. I use an array since im using webservices and want interop

Hibernate version:

2.1.6

Mapping documents:

<hibernate-mapping>
<class name="com.playingwithmatches.xeg.webservices.Organisation" table="organisations">

<id name="organisationid" column="organisationid" type="java.lang.Long"

unsaved-value="null">
<generator class="hilo"/>
</id>

<property name="name" column="name" type="string"
length="15" not-null="true"/>

<property name="owner" column="owner" type="string"
length="15" not-null="true"/>

<property name="address" column="address" type="string"
length="15" not-null="true"/>

<property name="url" column="url" type="string"
length="15" not-null="true"/>

<array name="users" table="users" cascade="all" inverse="false" >
<key column="organisationid"/>
<index column="i"/>
<one-to-many class="com.playingwithmatches.xeg.webservices.User"/>
</array>

</class>
</hibernate-mapping>


<hibernate-mapping>
<class name="com.playingwithmatches.xeg.webservices.User" table="users" optimistic-lock="all" dynamic-update="true">

<id name="id" column="id" type="java.lang.Long" unsaved-value="null">
<generator class="hilo"/>
</id>

<property name="firstname" column="firstname" type="string" length="12" not-null="true"/>
<property name="lastname" column="lastname" type="string" length="15" not-null="true"/>

<property name="address" type="string" column="address" length="255" not-null="true"/>

<property name="username" type="string" column="username" length="16" not-null="true" unique="true" update="false">
</property>

<property name="password" type="string" column="password" length="12" not-null="true"/>

<property name="email" type="string" column="email" length="255" not-null="true"/>

<many-to-one name="organisation" class="com.playingwithmatches.xeg.webservices.Organisation" column="organisationid" cascade="all"/>

</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():


Full stack trace of any exception that occurs:

2004-10-05 19:54:11,749 DEBUG com.playingwithmatches.xeg.webservices.Userservice
SoapBindingImpl - saving user with username 'tom'
Hibernate: insert into organisations (name, owner, address, url, organisationid)
values (?, ?, ?, ?, ?)
Hibernate: insert into users (firstname, lastname, address, username, password,
email, organisationid, id) values (?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: select user0_.id as id1_, user0_.firstname as firstname1_, user0_.las
tname as lastname1_, user0_.address as address1_, user0_.username as username1_,
user0_.password as password1_, user0_.email as email1_, user0_.organisationid a
s organisa8_1_, organisati1_.organisationid as organisa1_0_, organisati1_.name a
s name0_, organisati1_.owner as owner0_, organisati1_.address as address0_, orga
nisati1_.url as url0_ from users user0_ left outer join organisations organisati
1_ on user0_.organisationid=organisati1_.organisationid where user0_.id=?
Hibernate: select users0_.organisationid as organisa8___, users0_.id as id__, us
ers0_.i as i__, users0_.id as id0_, users0_.firstname as firstname0_, users0_.la
stname as lastname0_, users0_.address as address0_, users0_.username as username
0_, users0_.password as password0_, users0_.email as email0_, users0_.organisati
onid as organisa8_0_ from users users0_ where users0_.organisationid=?
net.sf.hibernate.HibernateException: null index column for collection: com.playi
ngwithmatches.xeg.webservices.Organisation.users

Name and version of the database you are using:

MySQL 4.0


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 1:40 am 
Newbie

Joined: Sun Sep 26, 2004 11:36 am
Posts: 7
ok so i guess i have to do http://www.hibernate.org/193.html

does this mean i have to add setParent / getParent ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.