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 subclass strategies
PostPosted: Sat Oct 03, 2009 2:12 am 
Newbie

Joined: Sat Oct 03, 2009 1:57 am
Posts: 3
Hi

I realise that you cant mix subclass strategies, ie having both discriminators and joined subclasses. However I have a problem where I have:

1. BaseType
2. PersonType:BaseType
3. LocationType:BaseType
4. CourseType:BaseType
<Doccuments> List

Ideally I would like PersonType and LocationType to use discrimators, as it will be faster to query from one table than do the joins, and have CourseType to be a joined subclass as has the List of documents.

Is there a way to do this, the only way I can see is either have everything as a joined subclass, or to have all but CourseType to use discrimators and to have CourseType to have its own independent type. Both solutions seem less than ideal, so wondering if anyone had any better ideas.

Thanks


Top
 Profile  
 
 Post subject: Re: Mixing subclass strategies
PostPosted: Sun Oct 04, 2009 8:04 am 
Senior
Senior

Joined: Mon Jul 07, 2008 4:35 pm
Posts: 141
Location: Berlin
Hi rjtt64,

yes, you can mix inheritance strategies but, I'm afraid, not within one level. Your BaseType will define the strategy and this will be the one for its sub-classes. I guess, you will be able to reduce the number of tables down to three: one for the BaseType, one for PersonType and LocationType, and one for CourseType. Since your BaseType table is likely to contain at least the shared identifier column and the discriminator column, Hibernate will always join the BaseType table if you query one of its sub-classes.

But let me know if you find an alternative way.

CU
Froestel

_________________
Have you tried turning it off and on again? [Roy]


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.