Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Beginning Hibernate From Novice to Professional phần 9
Đang chuẩn bị liên kết để tải về tài liệu:
Beginning Hibernate From Novice to Professional phần 9
Khánh Trang
82
35
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Ngoài ra, bộ lọc Hibernate có thể được tham số, trong đó đặc biệt hữu ích khi bạn đang xây dựng các ứng dụng trên đầu trang của Hibernate rằng vai trò an ninh sử dụng hoặc cá nhân. Ví dụ, hãy xem xét một ứng dụng web quản lý hồ sơ người dùng. | APPENDIX A MORE ADVANCED FEATURES 259 Transaction tx session.beginTransaction Make our bookings. session.save new Booking dave F1 session.save new Booking jeff C3 The confirmation letters should not be sent out until AFTER the commit completes. tx.commit The interceptor that we are applying is going to capture the information from the Booking objects that we are storing in the database. Listing A-26 demonstrates the basic mechanism but it is only a toy example. We will discuss some of its deficiencies in a moment. Listing A-26. An Interceptor Implementation package com.hibernatebook.advanced.events import java.io.Serializable import java.util.Collection import java.util.HashSet import java.util.Iterator import org.hibernate.CallbackException import org.hibernate.EntityMode import org.hibernate.Interceptor import org.hibernate.Transaction import org.hibernate.type.Type public class BookingInterceptor implements Interceptor public BookingInterceptor private ThreadLocal stored new ThreadLocal public void afterTransactionBegin Transaction tx stored.set new HashSet public void afterTransactionCompletion Transaction tx if tx.wasCommitted Iterator i Collection stored.get .iterator 260 APPENDIX A MORE ADVANCED FEATURES while i.hasNext Booking b Booking i.next sendMail b stored.set null public boolean onSave Object entity Serializable id Object state String propertyNames Type types throws CallbackException Collection stored.get .add entity return false private void sendMail Booking b Here we would actually send out the e-mail System.out.print Name b.getName System.out.println Seat b.getSeat public void beforeTransactionCompletion Transaction tx public int findDirty Object entity Serializable id Object currentState Object previousState String propertyNames Type types return null public Object getEntity String entityName Serializable id throws CallbackException return null public String getEntityName Object object throws CallbackException return null public Object instantiate
TÀI LIỆU LIÊN QUAN
Beginning Hibernate From Novice to Professional
Beginning Hibernate From Novice to Professional phần 1
Beginning Hibernate From Novice to Professional phần 2
Beginning Hibernate From Novice to Professional phần 3
Beginning Hibernate From Novice to Professional phần 4
Beginning Hibernate From Novice to Professional phần 5
Beginning Hibernate From Novice to Professional phần 6
Beginning Hibernate From Novice to Professional phần 7
Beginning Hibernate From Novice to Professional phần 8
Beginning Hibernate From Novice to Professional phần 9
crossorigin="anonymous">
Đã 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.