地址: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操作数据库。
相关推荐
用于获得Session会话及关闭Session会话
HibernateSessionFactory.java
hibernate中的SessionFactoryhibernate中的SessionFactoryhibernate中的SessionFactory
Hibernate是一个开放源代码的对象关系映射框架,它对JDBC进行了非常轻量级的对象封装,使得Java...Hibernate的核心接口一共有6个,分别为:Session、SessionFactory、Transaction、Query、Criteria和Configuration。
Hibernate的核心接口一共有5个,分别为:Session、SessionFactory、Transaction、Query和Configuration。
NULL 博文链接:https://chaoyi.iteye.com/blog/2148991
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name=...
一个实例小工程,讲解的是将hibernate的sessionFactory交给spring管理的配置方法
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value>classpath:hibernate.cfg.xml </property> </bean> --> ...
博文链接:https://shaqiang32.iteye.com/blog/201918
<property name="sessionFactory" ref="sessionFactory"></property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory...
Hibernate中的sessionFactory
Hibernate的核心接口一共有5个,分别为:Session、SessionFactory、Transaction、Query和Configuration。这5个核心接口在任何开发中都会用到。通过这些接口,不仅可以对持久化对象进行存取,还能够进行事务控制。
<property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置事务拦截器--> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor....
<property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 其它Bean定义在此 --> <!-- 定义拦截器 --> <bean id="transactionInterceptor" class="org.springframework....
<property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 配置基于注解的事务支持--> <tx:annotation-driven transaction-manager="transactionManager"/> 2,测试代码 1...
<property name="sessionFactory" ref="mysessionFactory"> </property> </bean> <bean name="/searchEmployee" scope="prototype" class="com.mysteelsoft.action.EmployeeAction"> ...
(S+S+H)(private_SessionFactory_属性_dao类)_方式_SSH_整合--总结
Session s= HibernateSessionFactory.getSession(); 就是Hibernate的工具java类