TAILIEUCHUNG - manning Hibernate in Action phần 6

Tham khảo tài liệu 'manning hibernate in action phần 6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 158 CHAPTER 5 Transactions concurrency and caching We aren t interested in the details of direct JDBC or JTA transaction demarcation. You ll be using these APIs only indirectly. Hibernate communicates with the database via a JDBC Connection hence it must support both APIs. In a stand-alone or web-based application only the JDBC transaction handling is available in an application server Hibernate can use JTA. Since we would like Hibernate application code to look the same in both managed and non-managed environments Hibernate provides its own abstraction layer hiding the underlying transaction API. Hibernate allows user extension so you could even plug in an adaptor for the CORBA transaction service. Transaction management is exposed to the application developer via the Hibernate Transaction interface. You aren t forced to use this API Hibernate lets you control JTA or JDBC transactions directly but this usage is discouraged and we won t discuss this option. The Hibernate Transaction API The Transaction interface provides methods for declaring the boundaries of a database transaction. See listing for an example of the basic usage of Transaction. Listing Using the Hibernate Transaction API Session session Transaction tx null try tx concludeAuction catch Exception e if tx null try catch HibernateException he log he and rethrow e throw e finally try catch HibernateException he throw he Understanding database transactions 159 The call to marks the beginning of a database transaction. In the case of a non-managed environment this starts a JDBC transaction on the JDBC connection. In the case of a managed environment it starts a new JTA transaction if there is no current JTA transaction or joins the existing current JTA transaction. This is all handled by Hibernate you shouldn t need to care about the implementation. The call to synchronizes .

TÀI LIỆU MỚI ĐĂNG
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.