第8行代码 session.update(board);
前后加上事务
Transaction tx=session.beginTransaction();
session.update(board);
tx.commit();
前后加上事务
Transaction tx=session.beginTransaction();
session.update(board);
tx.commit();
解决方案 »
- 亨利图&序列图
- java对word的操作
- ++++Spring 中的DispaterServlet 是怎么找到SimpleUrlHandlerMapping 这个bean实例的?
- Struts中多个JSP共用一个formbean在validator出现每个页面都抱错,怎么办啊
- 关于在struts中多个struts-config.xml文件的问题
- 这里双向多多关系怎么写?求理顺思路
- 请教?在tomcat admin中配置的datasource存放在什么文件中.
- 菜鸟的问题,请各位高手帮忙...JDK配置问题..
- 如何配置EJB服务器
- 一个菜鸟问题
- 使用SpringMVC的J2ee项目在windows下可以访问,linux下无法访问url path
- 报错!!javax.servlet.ServletException: Servlet execution threw an exception
SessionFactory sf = getHibernateTemplate().getSessionFactory();
Session si = sf.getCurrentSession();
SessionFactory sf = getHibernateTemplate().getSessionFactory();
Session si = sf.getCurrentSession();
为什么不直接用hibernate模板方法getHibernateTemplate,这样不需要再开启、关闭事务了
SessionFactory sf = getHibernateTemplate().getSessionFactory();
Session si = sf.getCurrentSession();
为什么不直接用hibernate模板方法getHibernateTemplate,这样不需要再开启、关闭事务了
因为有些写数据库的操作必须在事务管理模式下完成,比如写oracle的大数据字段blob.
SessionFactory sf = getHibernateTemplate().getSessionFactory();
Session si = sf.getCurrentSession();
为什么不直接用hibernate模板方法getHibernateTemplate,这样不需要再开启、关闭事务了
因为有些写数据库的操作必须在事务管理模式下完成,比如写oracle的大数据字段blob.
事务当然还要用的,直接用getHibernateTemplate.save(),配spring声明式事务,这样呢