的休眠是沒有得到繼承屬性,我在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