-->
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: complicated inheritance strategy mapping
PostPosted: Sun Mar 02, 2008 10:31 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
Hi, I am not a hibernate newbie, and thanks the hibernate I've built many applications using hibernate.

I need to map a complicated inheritance strategy, and I can't find how should I do it:

Code:
public class A { // mapped to table TB_A with a discriminator
...
}

public class B extends A { // mapped to table TB_B
...
}

public abstract class C extends B { // mapped to table TB_C
...
}

public class D extends C { // mapped to table TB_C
...
}

public class E extends C { // mapped to table TB_C
...
}


when I just use table per subclass with discriminator strategy everything is
okay, but I want to map C, D and E in a table per class hierarchy way.

I use Hibernate 3.2.5 with hbm.xml for mapping this structure.

the best result I've got is when querying D is:

Code:
select ...
from
   TB_A this_
   inner join TB_B this1_ on this1_.id = this_.id
   inner join TB_C this2_ on this2_.id = this_.id
   inner join TB_C this3_ on this3_.id = this_.id
...


well the result is correct but there are to joins for table TB_C in the generated SQL, is there any solution to fix this problem?

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


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.