標籤:
Connection介面中定義了5中隔離等級常量
Connection.TRANSACTION_NONE -- 不支援事務
Connection.TRANSACTION_READ_UNCOMMITTED -- 髒讀(交易回復造成別的事務讀取到的資料不準確),不可重複讀取和幻讀均可發生
Connection.TRANSACTION_READ_COMMITTED -- 不可重複讀取和幻讀均可發生
Connection.TRANSACTION_REPEATABLE_READ – 幻讀發生(表一記錄學生,表二記錄表一統計資訊。)
Connection.TRANSACTION_SERIALIZABLE -- 可序列化事務
Javax.ejb.TransactionAttributeType枚舉中定義的事務屬性:
TransactionAttributeType.MANDATORY
If a client invokes the enterprise bean‘s method while the client is associated with a transaction context, the container invokes the enterprise bean‘s method in the client‘s transaction context.
TransactionAttributeType.NEVER
The client is required to call without a transaction context, otherwise an exception is thrown.
TransactionAttributeType.NOT_SUPPORTED
The container invokes an enterprise bean method whose transaction attribute NOT_SUPPORTED with an unspecified transaction context.
TransactionAttributeType.REQUIRED
If a client invokes the enterprise bean‘s method while the client is associated with a transaction context, the container invokes the enterprise bean‘s method in the client‘s transaction context.
TransactionAttributeType.REQUIRES_NEW
The container must invoke an enterprise bean method whose transaction attribute is set to REQUIRES_NEW with a new transaction context.
TransactionAttributeType.SUPPORTS
If the client calls with a transaction context, the container performs the same steps as described in the REQUIRED case.
Java EE (9) -- JDBC & JTA