I have following model,
@Entity
@Table(name = "user")
@PrimaryKeyJoinColumn(name="user_id")
@SecondaryTables({
@SecondaryTable(name = "user_personal_details", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "user_id", referencedColumnName = "user_id")}),
@SecondaryTable(name = "user_address", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "user_id", referencedColumnName = "user_id")}),
@SecondaryTable(name = "user_contact_info", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "user_id", referencedColumnName = "user_id")}),
@SecondaryTable(name = "user_auth_info", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "user_id", referencedColumnName = "user_id")})
})
public abstract class User extends Member implements IUser {
@Column(table="user_personal_details")
private UserPersonalDetails personalInfo;
@Column(table="user_address")
private Address address;
@Column(table="user_contact_info")
private UserContactDetails contactDetails;
@Column(table="user_auth_info")
private UserAuthInfo authInfo;
...
}
When I try to insert a subclass of User
I get an error shown below
10641 [main] ERROR org.hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure:Table user_personal_details not found
Please shed some light on this behavior.
Class Definitions:-
ManagedObject Class
@Entity
@Table(name="managed_object")
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class ManagedObject implements IManagedObject
{
@Id
@Column(name="mo_id", nullable=false, updatable=false)
private String id;
@Column(name="mo_name", nullable=false, updatable=true)
private String name;
@Column(name="mo_type", nullable=false, updatable=true)
private String type;
@Column(name="mo_additional_info", nullable=true, updatable=true)
private String additionalInfo;
...
}
Member Class
@Entity
@Table(name="t_member")
@PrimaryKeyJoinColumn(name="member_id")
public abstract class Member extends ManagedObject implements IMember {
}
One of the Data/Info Class like UserPersonalDetails
@Embeddable
@Table
public class UserPersonalDetails extends InfoObject{
private String firstName;
private String middleName;
private String lastName;
...
}
Update:
Added @Column(table="")
annotation in UserPersonalDetails members and yes I do have @Embedded
annotation in User
class.
I have encountered following exception:
4469 [main] ERROR org.hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: Table user_personal_details not found