-->
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: Mixing Joined and Table per concrete class inheritance
PostPosted: Thu May 12, 2011 8:05 am 
Newbie

Joined: Fri Dec 17, 2010 1:50 am
Posts: 2
Hi Everyone,

I have classes A, B, C, D, E and F where
B extends from A, C extends from B
D extends from A, E extends from D
F extends from A.

I want to use Joined inheritance strategy at A and Table per concrete class inheritance strategy from B,D and F level.
A,B and D are abstract classes and C,E and F are concrete classes.

Is this possible and if yes how should we do it. When I try, I end up getting separate tables for all 6 classes and I want 4 tables to get created (one for A and 3 for C,E and F respectively).

I used @Inheritance(strategy = InheritanceType.JOINED) in class A and
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) in classes B,D and F

I have seen examples to mix table per hierarchy and joined inheritance strategies but I want to implement what I mentioned above without using table per hierarchy.

Please help me out.


Top
 Profile  
 
 Post subject: Re: Mixing Joined and Table per concrete class inheritance
PostPosted: Wed Nov 30, 2011 10:52 am 
Newbie

Joined: Wed Nov 30, 2011 10:28 am
Posts: 1
Hi there,
Almost a year ago and no response...
I have the same problem now.
What I found out is that mixing inheritance strategy is not possible according to JPA spec. IMHO joined strategy is a spec flaw as you loose control about your tables since every class in hierarchy is reflected in DB regatdles if annotaded as entity or not (maybe abstract class is added just for technical reason).

However some things can be archieved by @SecondaryTable.
In my case I am still looking for a solution since I get exorbitant joins and bad performance with JPA / hibernate. Might be a specific scenario but without solution, I will have to go back to levels of iBatis or even JDBC, what I would like to avoid.

Cheers
Joerg


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.