Session 异常1
来源:互联网 发布:淘宝客助手手机版 编辑:程序博客网 时间:2024/05/18 14:24
异常一:org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
批量执行sql语句时调用:
HibernateTransactionManager transactionManager = (HibernateTransactionManager)ac.getBean("transactionManager");
Query query = transactionManager.getSessionFactory().openSession().
createSQLQuery("UPDATE tms_product p SET p.number_1 = 0");
query.executeUpdate();
说明:当没有事务启动的时候,getCurrentSession是无法创建Session的
当然,我的方法是不带事务的
为什么openSession可以,opensession是从sessionfactory得到一个新的session,所以可以使用,而getCurrentSession是从当前线程中得到事务开始时创建transaction的那个session
异常二:could not execute native bulk manipulation query
session写HQL:
session.CreateSqlQuery("DELETE VotableNode vn WHERE vn.votingSetBucketId = :bucketId").SetParameter("bucketId", buckedId).ExecuteUpdate();
- Session 异常1
- 异常、Session、接口
- DWR 异常SESSION ERROR
- no-session异常
- session关闭异常的处理
- session not found 异常处理
- memcached session共享Timeout异常
- session序列化异常、session的销毁方式
- Hibernate--Session session = sessionFactory.getCurrentSession()空指针异常
- Session与atlas使用可能报异常。
- 关于Stateful Session Bean一个异常
- DBLINK的session无法关闭,报异常!
- 全局处理函数(处理session、异常等)
- DWR的异常处理及session过期
- 异常:could not initialize proxy - no Session
- hibernate的异常 Session was already closed
- Tomcat 抛出 Cannot serialize session attribute 异常
- tomcat启动有关session的异常
- linux shell脚本犯错
- 开篇
- 解决VS2010部分智能提示为英文的问题
- 为Android安装BusyBox —— 完整的bash shell
- M3调试方法
- Session 异常1
- [QT] error LNK2001: 无法解析的外部符号 Qt的moc机制
- Ural1084. Goat in the Garden
- 两道趣味题目解答
- 使用Kettle来完成数据迁移
- 为Android加入busybox工具
- Linux驱动之设备模型(8)
- Linux驱动之设备模型(9)-platform
- 明天....