我无法找到在ejb中设置TransactionIsolation的方法。任何人都可以告诉我如何设置它?我正在使用持久性。
我查看了以下课程: EntityManager,EntityManagerFactory,UserTransaction。他们似乎都没有像setTransactionIsolation这样的方法。我们需要更改persistence.xml吗?
我刚读了一本名为Mastering EJB 3.0 4th edition的书。他们给出了关于隔离级别的完整的10页理论,这个问题发生了,并且发生了这样的事情,但最后他们给出了这一段: -
"As we now know, the EJB standard does not deal with isolation levels directly,
and rightly so. EJB is a component specification. It defines the behavior and
contracts of a business component with clients and middleware infrastructure
(containers) such that the component can be rendered as various middleware
services properly. EJBs therefore are transactional components that interact
with resource managers, such as the JDBC resource manager or JMS resource
manager, via JTS, as part of a transaction. They are not, hence, resource
components in themselves. Since isolation levels are very specific to the
behavior and capabilities of the underlying resources, they should therefore be
specified at the resource API levels. "
究竟是什么意思?资源级API的含义是什么?请帮我。如果持久性无法设置隔离级别,那么为什么他们会在EJB书中提供如此庞大的理论并使其在重量上不必要地增加:(
答案 0 :(得分:5)
如EJB规范所述
只要系统允许并发执行多个工作单元,事务不仅会使工作单元完成原子,,而且还会将工作单元彼此隔离。
我希望它可以满足您的需求
答案 1 :(得分:-1)
请参阅this