hibernate错误提示: No Hibernate Session bound to thread, and configuration does not allow creation of no
来源:互联网 发布:nba2k16mc最帅捏脸数据 编辑:程序博客网 时间:2024/05/19 17:26
org.hibernate.HibernateException: No Hibernate Session bound to thread, andconfiguration does not allow creation of non-transactional one here
atorg.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
atorg.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:622)
at com.dao.impl.MyTypeImpl.getParent(MyTypeImpl.java:29)
一直也找不到原因,后来突然发现,自己确实是没有配置事物,自己的那个操作方法名字是:
public List<MyType> getParent();
而事务配置为
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"></property></bean><tx:annotation-driven transaction-manager="transactionManager" /><tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><tx:method name="Add*" propagation="REQUIRED" isolation="DEFAULT" /><tx:method name="Delete*" propagation="REQUIRED" isolation="DEFAULT" /><tx:method name="Update*" propagation="REQUIRED" isolation="DEFAULT" /><tx:method name="Query*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /><tx:method name="LoginInfo*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /><tx:method name="QueryAll*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /></tx:attributes></tx:advice>
事务里没有配置以“get”开头的方法名,所以导致使用get开发方法错误,加上<tx:method name="get*" propagation="NOT_SUPPORTED" isolation="DEFAULT" />后问题解决,修改后的配置文件如下:
<tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><tx:method name="Add*" propagation="REQUIRED" isolation="DEFAULT" /><tx:method name="Delete*" propagation="REQUIRED" isolation="DEFAULT" /><tx:method name="Update*" propagation="REQUIRED" isolation="DEFAULT" /><tx:method name="Query*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /><tx:method name="LoginInfo*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /><tx:method name="QueryAll*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /><tx:method name="get*" propagation="NOT_SUPPORTED" isolation="DEFAULT" /></tx:attributes></tx:advice>
- hibernate错误提示: No Hibernate Session bound to thread, and configuration does not allow creation of no
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- 关于: No Hibernate Session bound to thread, and configuration does not allow creation of non-transacti
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- 解决No Hibernate Session bound to thread, and configuration does not allow creation of non-transaction
- Spring+Hibernate 异常No Hibernate Session bound to thread, and configuration does not allow creation
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transac
- @Transactional未添加就报错:No Hibernate Session bound to thread, and configuration does not allow creation
- HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation
- 执行文件路径的变量:$PATH(PATH变量简介)
- 如何正确的创建线程,终了线程(2)
- Delphi图像处理
- mysql中文读出问号,以及SET NAMES not allowed by driver错误解决方案
- c++ 拷贝构造函数调用时机
- hibernate错误提示: No Hibernate Session bound to thread, and configuration does not allow creation of no
- IE8新建选项卡“网页有错误,找不到元素”
- error LNK2001: unresolved external symbol
- Android::开放root权限
- 三个数求其中的最大值和最小值
- SQL Server查看表空间占用情况
- freopen函数浅析
- CloudFoundry bundle install 遇到 ExtensionBuildError问题时
- PostgreSQL基本知识:数值类型