Java EE (9) -- JDBC & JTA

來源:互聯網
上載者:User

標籤:

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.