错误信息:Bean property 'sessionFactory' is not writable or has an invalid setter met

地址:http://blog.csdn.net/xinxin19881112/article/details/8916072

错误信息:
org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [dao.impl.UserDaoImpl]: Does the parameter type of the setter match the return type of the getter?



方法1、

   在对应UserDaoImpl中加入sessionfactory的set方法、get方法。

    private SessionFactory sessionFactory;
    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    继承JdbcDaoSupport。
    UserDaoImpl extends JdbcDaoSupport


方法2、
UserDaoImpl extends HibernateDaoSupport


用JdbcTempalte或HibernateTempalte操作数据库。

你可能感兴趣的:(Hibernate,sessionFactory)