У меня есть следующая модель,
@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;
...
}
Когда я пытаюсь вставить подкласс User
, я получаю сообщение об ошибке, показанное ниже
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
Пожалуйста, пролите немного света на это поведение.
Определения классов: -
Класс ManagedObject
@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;
...
}
Класс участника
@Entity
@Table(name="t_member")
@PrimaryKeyJoinColumn(name="member_id")
public abstract class Member extends ManagedObject implements IMember {
}
Один из классов данных / информации, например UserPersonalDetails
@Embeddable
@Table
public class UserPersonalDetails extends InfoObject{
private String firstName;
private String middleName;
private String lastName;
...
}
Обновление:
Добавлена аннотация @Column(table="")
в членах UserPersonalDetails, и да, у меня есть аннотация @Embedded
в классе User
.
Я столкнулся со следующим исключением:
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