-->
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.  [ 2 posts ] 
Author Message
 Post subject: one table depnds on two other - Mapping?
PostPosted: Tue Sep 14, 2004 7:24 am 
Newbie

Joined: Fri Sep 03, 2004 6:24 am
Posts: 2
Hello I've three tables.
table one
table two
table depend

depend has the columns one_id, two_id and some others. one_id and two_id is the Primary Key

one and depend have a 1:n relation.
two and depend have a 1:n relation too.

How can i constitute that a entry in depend depends on one and two.
In my Java-files i don't want to have a one-object and a two-object. I only want for the row one object. It must be sure, that one, two and depend are not independet.

I hope my problem is understandable.

How to map the depend.hbm.xml file? And the other two files?




Hibernate version:
newest

Mapping documents:

current wrong mapping for depend:

<many-to-one
name="tasOne"
class="tas.beans.hibernate.One"
not-null="true"
cascade="none"
>
<column name="one_id" />
</many-to-one>

<many-to-one
name="tasTwo"
class="tas.beans.hibernate.Two"
not-null="true"
cascade="none"
>
<column name="two_id" />
</many-to-one>

This is wrong, because there ist no relation between one and two

Full stack trace of any exception that occurs:

Name and version of the database you are using:
mysql 4.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2004 11:59 am 
Newbie

Joined: Sun Apr 18, 2004 11:12 pm
Posts: 3
Location: Waltham, MA
assuming that your primary key columns are also foreign keys to table one and table two you should try the composite-id on depend with <key-many-to-one for every column.


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

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.