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
|