-->
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.  [ 1 post ] 
Author Message
 Post subject: How to use the
PostPosted: Fri Jul 22, 2005 1:35 am 
Newbie

Joined: Sat Feb 26, 2005 10:10 pm
Posts: 8
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]


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

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.