spring事务异常

来源:互联网 发布:linux 删除命令行 编辑:程序博客网 时间:2024/05/19 15:21


spring配置多个数据源和事务的时候,当一个service去调用另外一个service时,两个servcie的事务必须一样,否则会出现以下异常:

javax.servlet.ServletException: org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.