的休眠是没有得到继承属性,我在Database
每个表的一些常见领域在父类POJO
ADDED_ON和added_by
我创建了一个POJO类:
public class CommonBean{
@Column(name="added_on")
public Date addedOn;
@Column(name="added_by")
public Integer addedBy;
//setters and getters
}
而且所有pojo
类extends
是pojo
类:
例如:
@Table(name = "employee")
@Entity
public class HrEmployee extends CommonBean implements java.io.Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer id;
@Column(name="first_name")
private String firstName;
@Column(name="middle_name")
private String middleName;
@Column(name="last_name")
private String lastName;
}
,但是当我打电话的休眠标准表法。 我可以看到生成的查询在控制台:
Hibernate:
/* criteria query */ select
this_.id as y0_,
this_.first_name as y2_,
this_.middle_name as y3_,
this_.last_name as y4_
from
hr_employee this_
为什么它没有得到来自它的父类的属性?
我不确定这是可能的还是我在某处出错。
感谢
尝试实体继承 - https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html#entity-inheritance – Chaitanya