-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with reverse and one-to-one
PostPosted: Mon Jan 02, 2006 12:34 pm 
Newbie

Joined: Thu Dec 08, 2005 9:04 am
Posts: 2
Hi all,

I have a problem with hbms generated from HibernateTools v3.1 beta2;
I have two tables, let's say:

table A with column ID (PK) and other fields
table B with column ID (PK) and other fields

table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)

When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:

<class name="B" table="B" schema="SCHEMA">
<id name="id" type="string">
<column name="ID" length="12" />
<generator class="assigned" />
</id>
<[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
<column name="ID" length="12" not-null="true" unique="true" />
</many-to-one>
....

And this one for table A:
<class name="A" table="A" schema="SCHEMA">
<id name="id" type="string">
<column name="ID" length="12" />
<generator class="assigned"/>
</id>
<set name="b" inverse="true">
<key>
<column name="ID" length="12" not-null="true" unique="true" />
</key>
<[b]one-to-many[/b] class="B" />
</set>
</class>

while I was expecting something like:
[i]<one-to-one name="a" class="A" constrained="true"/>[/i]
in table B, and the same or nothing in table A.

Is this due to a wrong database design or is this a reverse engineering problem ?

Thank you in advance
Andi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 3:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 4:36 am 
Newbie

Joined: Thu Dec 08, 2005 9:04 am
Posts: 2
Thank you,

I'll post to Jira.

Andrea


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.