Hibernate version: Hibernate 3.0.2. Hibernate Tools 3.0, Hibernate Annotations 3.0 b1
Name and version of the database you are using: MySql 4.1
I am attempting to do some simple inheritance utilizing Hibernate 3.0.1, Hibernate Tools 3.0, and Hibernate Annotations 3.0 beta 1.
My sample code goes something like this:
I have a Person class, and an Employee Class, Employee extends Person, and I want to utilize the Table-per-class Inheritance Type :
Code:
@Entity()
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS )
@Table(name="PERSON")
public class Person implements Serializable {
....
@Entity()
@Table(name="EMPLOYEE")
public class Employee extends Person implements Serializable {
When I export the schema for these two classes, I get one PERSON table with all the attributes of Person and Employee. No EMPLOYEE table is generated.
I have tried modifying the code in many ways, including moving the Inheritance Annotation to Employee and removing it from Person, to no avail (that actually throws an exception). I have also tried various other things to fix this problem to no avail.
Is the TABLE_PER_CLASS inheritance strategy not supported by the schema exporter or annotations or what?
Any help would be appreciated.
Thank you.