我在jpa中实现inheritence有问题。我有以下实体:处理继承层次结构3层深jpa
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Person implements Serializable{
private String name;
private String }
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class User extends Person {
private String salary;}
public class chef extends User{}
我希望所有的实体都是具体的,这是正确的还是应该改变一些东西?
看起来好,你有什么问题? – James
我想插入表中的用户现有的用户在厨师:用户厨师=新厨师(); chef =(用户)dao.trouverPersonneParId(“mark”); \t \t dao.ajout_createur(chef);但我有这个错误:java.lang.ClassCastException:com.pfe.domaine.User不能转换为com.pfe.domaine.Chef – joice
你可以发布关于你的dao的代码吗?看起来有一段时间从'User'到'Chef'的表演,这就是为什么我想看看你在做什么,看看我能不能帮助你。 –