Solutions to Common Problems
本节描述了某些常见问题的一些解决方案。
This section describes solutions to some common problems.
Using the Wrong Transaction Manager for a Specific DataSource
根据你选择的事务技术和要求,使用正确的 PlatformTransactionManager
实现。正确使用后,Spring Framework 仅仅提供一个直接可移植的抽象。如果你使用全局事务,你必须为所有事务操作使用 org.springframework.transaction.jta.JtaTransactionManager
类(或它的一个 application server-specific subclass)。否则,事务基础设施会尝试对容器 DataSource
实例等资源执行本地事务。这样的本地事务没有意义,一个好的应用程序服务器会将它们作为错误进行处理。
Use the correct PlatformTransactionManager
implementation based on your choice of
transactional technologies and requirements. Used properly, the Spring Framework merely
provides a straightforward and portable abstraction. If you use global
transactions, you must use the
org.springframework.transaction.jta.JtaTransactionManager
class (or an
application server-specific subclass of
it) for all your transactional operations. Otherwise, the transaction infrastructure
tries to perform local transactions on such resources as container DataSource
instances. Such local transactions do not make sense, and a good application server
treats them as errors.