我有3个表格,例如:table_A, table_B and table_C.
A是B和C的父级。如何在hibernate中的父表时保存表。
答案 0 :(得分:0)
如果已将表映射到实体,则:
示例:
//parent
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Car {
}
@Entity
public class BCar extends Car {}
@Entity
public class CCar extends Car {}
session.save(bCar);
session.save(cCar);