请教高手CompanyCustomer从Customer继承,但是启动tomcat6的时候出现Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer],不知道是怎么回事?多谢
Customer.java@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="discriminator",
discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("customer")
public class Customer {
private int id;
private Customer parent; public String getCategory(){
return "未知";
} @Id
@GeneratedValue
public int getId() {
return id;
} public void setId(int id) {
this.id = id;
}
@ManyToOne
@JoinColumn(name="pid")
public Customer getParent() {
return parent;
} public void setParent(Customer parent) {
this.parent = parent;
}
}CompanyCustomer.java
@Entity
@DiscriminatorValue("company")
public class CompanyCustomer extends Customer {
//人员规模
private String employeeSize;
@Column(insertable=false,updatable=false)
public String getCategory(){
return "公司";
}
public String getEmployeeSize() {
return employeeSize;
} public void setEmployeeSize(String employeeSize) {
this.employeeSize = employeeSize;
}
}
Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.hibernate.PropertyNotFoundException: Could not find a setter for property category in class com.wdl.crm.model.PersonalCustomer不写这一句@Column(insertable=false,updatable=false)
则会出现重复映射的问题,不知道怎么解决,找了一天都没找到问题出在哪里,和没有setCategory方法没关系,因为我在父类和子类把getCategory方法都去掉也报同样的错误
Customer.java@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="discriminator",
discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("customer")
public class Customer {
private int id;
private Customer parent; public String getCategory(){
return "未知";
} @Id
@GeneratedValue
public int getId() {
return id;
} public void setId(int id) {
this.id = id;
}
@ManyToOne
@JoinColumn(name="pid")
public Customer getParent() {
return parent;
} public void setParent(Customer parent) {
this.parent = parent;
}
}CompanyCustomer.java
@Entity
@DiscriminatorValue("company")
public class CompanyCustomer extends Customer {
//人员规模
private String employeeSize;
@Column(insertable=false,updatable=false)
public String getCategory(){
return "公司";
}
public String getEmployeeSize() {
return employeeSize;
} public void setEmployeeSize(String employeeSize) {
this.employeeSize = employeeSize;
}
}
Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.hibernate.PropertyNotFoundException: Could not find a setter for property category in class com.wdl.crm.model.PersonalCustomer不写这一句@Column(insertable=false,updatable=false)
则会出现重复映射的问题,不知道怎么解决,找了一天都没找到问题出在哪里,和没有setCategory方法没关系,因为我在父类和子类把getCategory方法都去掉也报同样的错误
解决方案 »
- 问一个访问地址如何根据参数动态进入方法
- HashMap缓存疑问
- hibernate 存入数据顺序与数据库不对应 求原因,求解决
- 熟悉POI及spring声明式事务的高手请进
- 关于开源CMS
- 请教:Struts分页问题
- 我的IE为什么总是自动关闭。
- struts 标签中如何给表单里的组件如multibox 起名,以区别
- 怎么样在Tag Library中实现页面直接跳转?
- No Hibernate Session bound to thread, and configuration does not allow creation
- maven Missing artifact 异常
- 求助!Struts2和Extjs整合的问题
建议换一种继承方式吧