From: Gavin_King/Cirrus%<CI...@ci...> - 2002-04-16 08:47:56
|
Hi Marco. Try the following: <hibernate-mapping> <class name="com.mticket.Client" table="Client"> <id name="clientId" type="long"> <generator class="cirrus.hibernate.id.HiLoGenerator"/> </id> <property name="name"/> <set role="besteld" readonly="true"> <key column="clientId"/> <one-to-many class="com.mticket.Order"/> </set> </class> <class name="com.mticket.Order" table="order"> <id name="orderid" type="long"> <generator class="cirrus.hibernate.id.HiLoGenerator"/> </id> <property name="description"/> <many-to-one name="Client" column="clientId" class ="com.mticket.Client"/> </class> </hibernate-mapping> For a bidirectional association, one (many-valued) end must be marked read-only, telling hibernate to use the other end for updating persistent state. Also the key column of the many-valued end must match the column of the single-valued end. Hope that makes sense.... peace Gavin |