REQUIRES_NEW transaction attribute pitfalls.
REQUIRES_NEW事务属性陷阱。
If that's the case, what good is this transaction attribute?
如果是这种情况,那么事务属性有什么好处呢?
The RequiresNew transaction attribute is an interesting one.
RequiresNew事务属性非常有趣。
The most common container-managed transaction attribute is Required.
最常用的容器管理的事务属性是Required。
The Never transaction attribute is perhaps the most interesting of all.
Never或许是最有趣的事务属性。
All of the EJB methods are configured with the Required transaction attribute.
所有的EJB方法都是用Required事务属性配置的。
In this case, the client is starting the transaction; hence the REQUIRED transaction attribute.
在这种情况下,客户机启动事务;因此使用REQUIRED事务属性。
The only use case I have been able to come up with for this transaction attribute is for testing.
我能想到的针对此事务属性的唯一一个用例就是用于测试。
The possible values for the transaction attribute and their descriptions are provided in Table 1.
事务属性的可能值及其描述在表1中列出。
An example of a LTC is an execution of a bean method with the transaction attribute NotSupported.
LTC的一个示例是含事务属性NotSupported的Bean方法的执行。
The key to transactional control with CMT is the EJB transaction attribute, which is discussed next.
使用CMT的事务控制的关键是接下来讨论的EJB事务属性。
This is the most commonly used transaction attribute and is the default for both EJB 3.0 and Spring.
这是最常用的事务属性,并且是EJB 3.0和Spring 的默认属性。
We tell the transaction advisor to apply the REQUIRED transaction attribute to all of the declared methods.
我们告诉事务顾问将 REQUIRED 事务属性应用于所有声明的方法。
All public read methods in the API layer by default should be marked with a transaction attribute of SUPPORTS.
api层中的所有公共读方法默认都应该标记一个SUPPORTS事务属性。
The Supports transaction attribute is another one that I find most developers don't fully understand or appreciate.
Supports事务属性也是我发现大多数开发人员未完全理解或掌握的一个地方。
For example, it might invoke a message-driven bean (MDB) with a container manager transaction attribute of Supports.
例如,它可能使用Supports的容器管理器事务属性来调用消息驱动bean (MDB)。
There are only a few use cases for this transaction attribute, and they primarily involve database stored procedures.
这个事务属性只有少许用例,并且它们主要涉及数据库存储过程。
This transaction attribute is used in the Client Orchestration transaction strategy described in this article's next section.
这个事务属性应用于本文下一部分将要讨论的Client Orchestration事务策略。
Support a current transaction; create a new one if none exists. Analogous to the EJB transaction attribute of the same name.
支持当前事务。如果当前没有事务则创建一个新的事务。
Interleaved transactions are enabled when a bean method's transaction attribute is set to RequiresNew in the deployment descriptor.
当bean方法的事务属性在部署描述符中设置为RequiresNew时,可以支持交叉事务。
This returns true if the MDB is using container-managed transactions and the method in question has a transaction attribute of Required.
如果MDB正在使用容器托管的事务,而且要处理的方法具有Required事务属性,那么isDeliveryTransacted会返回true。
In addition to the rollback directives, you must also specify the transaction attribute, which defines how the transaction should behave.
除了回滚指令之外,您还必须指定事务属性,这将定义事务的行为。
The EJB container starts a global transaction when the EJB methods are configured with the Required or RequiresNew transaction attribute.
当使用Required或RequiresNew事务属性配置了EJB方法时,EJB容器就启动一个全局事务。
If you use the Never transaction attribute and receive an exception when invoking the method in question, you know a transaction was present.
如果您在调用相应的方法时使用了Never事务属性并且接收到了一个异常,则知道事务已经呈现。
The semantics of the REQUIRED transaction attribute are the same as in J2EE, meaning that the method will always execute within a transaction.
REQUIRED事务属性的语义与J2EE中相同,这意味着该方法将始终在事务中执行。
On the other hand, if the MDB specifies a transaction attribute of "Required," then XA should be enabled for its connection-factory-jndi-name.
另一方面,如果MDB指定事务属性为“Required”,则应该为其connection - factory - jndi- name启用XA。
The NotSupported transaction attribute specifies that the method being called will not use or start a transaction, regardless if one is present.
NotSupported事务属性指定被调用的方法将不使用或启动事务,无论是否呈现了事务。
If the transaction attribute takes the other allowed value of NotSupported, or the MDB is using bean-managed transactions, then it returns false.
如果事务属性采用NotSupported允许的其他值,或者MDB正在使用bean托管的事务,则返回false。
The REQUIRES_NEW transaction attribute always starts a new transaction when the method is started, whether or not an existing transaction is present.
REQUIRES_NEW事务属性总是会在启动方法时启动一个新的事务。
For each of the transaction strategies I'll cover in subsequent articles in this series, I'll discuss use of this transaction attribute in more detail.
对于本系列后续文章将要讨论的各事务策略,我将更加详细地阐述这个事务属性。
应用推荐