我发现在会话 bean 中,在使用 Container-Managed-Transactions 时,可以使用 REQUIRED / SUPPORTS 等事务属性使事务与现有的客户端事务连接。
在使用 Bean-Managed-Transaction 时,有没有办法使该事务与现有的客户端事务连接?
我发现在会话 bean 中,在使用 Container-Managed-Transactions 时,可以使用 REQUIRED / SUPPORTS 等事务属性使事务与现有的客户端事务连接。
在使用 Bean-Managed-Transaction 时,有没有办法使该事务与现有的客户端事务连接?
No (See § 13.6.1 and § 13.6.2 in the spec).
But why would you do that anyway? If the bean is meant to join a transaction started somewhere else, just make if CMT with REQUIRED. It's the same situation when a BMT bean whan to call another bean. The BMT bean controls the transaction demarcation, and the other bean uses CMT to join the transaction.
Note also that in the spec, the term "client" refers to the caller of a bean, it can be another bean, a stand-alone client, or external client (e.g. web service request).