Hello, I'm using Hibernate version 3.3.2.GA with annotations.
I have inheritance between two classes, the former:
Code:
@Entity
@Table(name = "SUPER_CLASS")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="DISCR_TYPE",
discriminatorType= DiscriminatorType.STRING
)
@org.hibernate.annotations.Entity(mutable = false)
public class SuperClass { }
The subclass is mapped with a secondary table:
Code:
@Entity
@DiscriminatorValue("VALUE")
@org.hibernate.annotations.Entity(mutable = false)
@SecondaryTable(name = "V_SECONDARY_TABLE",
pkJoinColumns = @PrimaryKeyJoinColumn(name = "ID", referencedColumnName = "ID"))
public class SubClass extends SuperClass {
@Embedded
public Field getField() {
return getField;
}
}
Where the field is composed of two different fields
Code:
@Embeddable
public Field HistoryInfo {
@Column("FIELD_1") String field1
}
Now when I create a query on SubClass the FIELD_1 is searched on the SuperClass, even if it's defined in the subclass.
I can't set the table in the column field, because the Field class it's reused somewhere. I need to specify it in SubClass class.
How do I specify that the field should be in the secondary table?