-->
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: Prevent JOINED inheritance to create unnecessary tables.
PostPosted: Fri Nov 05, 2010 2:03 pm 
Newbie

Joined: Sat Sep 18, 2010 12:30 pm
Posts: 1
Hello all, I have the following question. I have a generic content model from which many content types inherit. The inheritance strategy defined through annotations is JOINED inheritance. The thing is, not all the subtypes have extra properties, but hibernate still generates extra tables, here's a sample:

Code:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class Content {
    int id;
    String text;
    (etc, etc, and a bunch of getters and setters)
   
}

@Entity
public class ExtendedContent extends Content {
    int otherProperty;

    (getter and setter)
}

@Entity
public class Comment extends Content {}


So with these 3 entities I get 3 tables, one for the base class, one for the ExtendedContent, and one for Comment. But the table comment (as expected I guess) only contains one column, which is a foreign key reference to the base table. So I think this is kind of redundant, any way to explicitly tell hibernate not to generate an extra table for Comment?


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.