-->
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: Single Table Per Inheritance Without The DiscriminatorColumn
PostPosted: Sun Mar 04, 2012 7:51 pm 
Regular
Regular

Joined: Tue Feb 17, 2009 3:36 pm
Posts: 78
Here is a problem I run into during Hibernate upgrading from 3.x to 4.1. I have entity classes in a single inheritance implemented with Hibernate Annotation 3.x package as the followings:
Code:
@MappedSuperclass
@Entity
@Table(name = "theTable")
public class Parent{
...
}

@Entity
@Table(name = "theTable")
public class Child extends Parent {
...
}

With the 4 version, the above needs to be modified as the followings:
Code:
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@Table(name = "theTable")
public class Parent{
...
}

@Entity
public class Child extends Parent {
...
}

Which is fine to me with one exception. All related queries will come with child0_.DTYPE='Child'.

Is a way to get rid of the default Discriminator Column or I have to add the column to my tables without any practice useability but just to meet the requirement?


Top
 Profile  
 
 Post subject: Re: Single Table Per Inheritance Without The DiscriminatorColumn
PostPosted: Mon Mar 05, 2012 8:43 pm 
Regular
Regular

Joined: Tue Feb 17, 2009 3:36 pm
Posts: 78
Any thought or suggestions on this subject? I would like to find a less-code-change solution. If no any better ideal, I guess the easiest way is to merge the child class to the parent class and forget about the inheritance.


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.