-->
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 <subclass>
PostPosted: Fri Feb 23, 2007 11:30 am 
Newbie

Joined: Tue Feb 06, 2007 10:49 am
Posts: 3
hi, all:

Right now I have problem with hibernate mappings:

I have 3 classes as following:

Class A {

private OtherClass1 other1;
}

Class B extends A {

private OtherClass2 other2;
}

Class C extends B {

}

I use one table to map the whole inheritance(table per class hierarchy). The mapping file is like this:

<<class
name="A"
table="tableABC"
>

<discriminator
column="type"
not-null="true"
type="string"
/>
<many-to-one
name="other1"
class="OtherClass1"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="Other1Id"
not-null="false"
/>

<subclass
name="B"
discriminator-value="typeb"
>

<many-to-one
name="other2"
class="OtherClass2"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="Other2Id"
not-null="false"
/>

<subclass
name="C"
discriminator-value="typec"
>

</subclass>
</subclass>
</class>


Here is the problem, when I create db schemas using hbm2ddl, I noticed that it create 2 identical foreign key constraint point to OtherClass2 table. But for OtherClass1 defined in Class A, only one foreign key constraint was created.

Does anybody knows why? Anything I can do to solve this problem?


This is urgent for me. So any idea will be really appreciated.

Thanks alot!


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.