-->
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: problem with mapping inheritance!
PostPosted: Fri Dec 15, 2006 7:10 pm 
Newbie

Joined: Fri Dec 15, 2006 6:39 pm
Posts: 1
Mapping documents:

Hi every one!

Ive got a problem with mapping inheritance:
User.hbm.xml(This xml file, contains mapping for both user and lab classes, lab extends user):

<hibernate-mapping>
<class
name="akschap.User"
table="users"
>
<id
name="userId"
type="long"
column="USER_ID"
length="10"
>
<generator class="native" />
</id>

<one-to-one
name="address"
class="akschap.Address"
cascade="all"/>
<property
name="password"
type="string"
column="PASSWORD"
not-null="true"
length="20"
/>
<property
name="type"
type="string"
column="TYPE"
not-null="true"
length="3"
/>

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

<property
name="tel"
type="long"
column="TEL"
not-null="true"
length="8"
/>

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

<property
name="username"
type="string"
column="USERNAME"
not-null="true"
length="20"
/>
<joined-subclass
name="akschap.Lab"
table="labs">
<key column="LAB_ID"/>

<set
name="errors"
inverse="true"
cascade="all-delete-orphan"
>
</joined-subclass>




</class>
</hibernate-mapping>


---------------
the thing is, i want my error mapping to look like thise,hence, i want a bidirectional(not unidirectional) relationship between "lab" and "error":

<hibernate-mapping>
<class
name="akschap.Error"
table="errors"
>
<meta attribute="implement-equals" inherit="false">true</meta>
<id
name="errorId"
type="java.lang.Long"
column="ERROR_ID"
length="10"
>
<generator class="native" />
</id>
<property
name="errorNumber"
type="string"
column="ERROR_NUMBER"
not-null="true"
length="20"
/>
<property
name="description"
type="string"
column="DESCRIPTION"
not-null="true"
length="500"
/>



<!-- bi-directional many-to-one association to Lab -->
<many-to-one
name="lab"
class="akschap.Lab"
>
<column name="LAB_ID" not-null="true" length="10"/>
</many-to-one>


<!-- bi-directional many-to-one association to LabMachine -->
<many-to-one
name="labMachine"
class="akschap.LabMachine"
>
<column name="MACHINE_ID" not-null="true" length="10"/>
</many-to-one>

</class>
</hibernate-mapping>

---------
sadly, this seems to be impossible.
error can not be mapped to lab, because lab is undefined in the congiguration file.

So, how can i have a bidirectional relationship between lab and error?
Please help me out!
Thanx:)
Neg


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.