Hibernate version:3cvs
Mapping documents:
<hibernate-mapping>
<class name="BaseItem"
table="base_item">
<id
name="id"
column="id"
type="long"
unsaved-value="0">
<generator class="native">
<param name="sequence">base_item_seq</param>
</generator>
</id>
<property name="startVersion" column="start_version"/>
<property name="endVersion" column="end_version"/>
<property name="objId" column="obj_id" />
<property name="name" column="name"/>
<property name="description" column="description"/>
<property name="keywords" column="keywords"/>
</class>
<joined-subclass name="Subclass1" extends="BaseItem" table="Subclass1">
<key column="id"/>
<property name="name" column="name"/>
<set name="entries" cascade="all">
<key column="parentObjId" property-ref="objId"/>
<one-to-many class="Subsclass1"/>
<sql-insert>...</sql-insert>
<sql-delete>...</sql-delete>
<sql-query>...</sql-query>
<sql-update>...</sql-update>
</set>
</joined-subclass>
<joined-subclass name="Subclass2" extends="BaseItem" table="Subclass2">
<key column="id"/>
<property name="tagName" column="tagName"/>
<property name="value" column="value"/>
<property name="parentObjId" column="parent_obj_id" /> </joined-subclass>
<hibernate-mapping>
Hi,
1) How can I access the objId property in the BaseItem from Subclass1 so that it can be used by the set declaration to associate with Subclass2?
I am not basing the <set> off of "id" as the key because there is more customizations not shown here to do CUD for different versions of the same object (using the sql-X to customize the persister).
Basically, there is no foreign key constraint on parentObjId and ObjId.
2) If I wanted the property parentObjId at the BaseItem level, how should I be writing the <set>?
<property name="parentObjId" column="parent_obj_id" />
Hope to get some response on this. We are running into a wall.
Thanks!
Theen-Theen
[/b]
|