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: Inheritence strategy - can you use both joined and single_ta
PostPosted: Wed Feb 17, 2010 9:24 pm 
Newbie

Joined: Thu Jul 16, 2009 5:23 pm
Posts: 11
I have a class hierarchy that looks something like this:

class A is abstract
class B is a concrete class, extends A
class C is an abstract class, extends A
classes C1, C2, and C3 are concrete classes, extends C.

C1, C2, C3 have some transient data and do not have any additional data to be stored in the database.

I would like to find an annotation that maps my object hierarchy to tables A, B, C. Something like this:

class A has
<table name="A"></table>
<inheritance strategy="JOINED"/>
<discriminator-column name="type" discriminator-type="STRING" />

class B has
<table name="B"></table>
<primary-key-join-column name="id" referenced-column-name="id"/>
<discriminator-value>B</discriminator-value>

class C has
<table name="C"></table>
<inheritance strategy="SINGLE_TABLE"/>
<discriminator-column name="type" discriminator-type="STRING" />

class C1 has
<primary-key-join-column name="id" referenced-column-name="id"/>
<discriminator-value>C1</discriminator-value>

class C2 has
<primary-key-join-column name="id" referenced-column-name="id"/>
<discriminator-value>C2</discriminator-value>

Does anyone know if hibernate or JPA supports a hybrid inheritance strategy using both joined and then single_table?

Thanks for any info you have provide!


Top
 Profile  
 
 Post subject: Re: Inheritence strategy - can you use both joined and single_ta
PostPosted: Mon Apr 05, 2010 6:51 pm 
Newbie

Joined: Mon Mar 30, 2009 5:15 pm
Posts: 6
I too would like to combine @Inheritance.JOINED with @DiscriminatorColumn since I have some subclasses which have their own extra data and some which do not.


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.