Spring3.2.0整合hibernate3 sessionFatory无法注入
控制台报错:
Bean property 'sessionFatory' is not writable or has an invalid setter method. Did you mean 'sessionFactory'?
DAO层类继承 HibernateDaoSupport类无法通过
this.getHibernateTemplate 获开session
this.语法错误
强行运行
控制台报错:
ERROR - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productDao' defined in class path resource [spring.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFatory' of bean class [cn.star.ssh.dao.ProductDao]: Bean property 'sessionFatory' is not writable or has an invalid setter method. Did you mean 'sessionFactory'?
DAO层代码:
public class ProductDao extends HibernateDaoSupport {
/**
* DAO中保存商品的方法
* @param product
*/
public static void save(Product product) {
System.out.println("DAO中的save方法执行了...");
this.getHibernateTemplate.save(product);
}
}
Spring 配置:
org.hibernate.dialect.SQLServerDialect
true
true
update
cn/star/ssh/entity/Product.hbm.xml |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|