TAILIEUCHUNG - Beginning Hibernate From Novice to Professional phần 9

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 Make our bookings. new Booking dave F1 new Booking jeff C3 The confirmation letters should not be sent out until AFTER the commit completes. 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 import import import import import import import import import public class BookingInterceptor implements Interceptor public BookingInterceptor private ThreadLocal stored new ThreadLocal public void afterTransactionBegin Transaction tx new HashSet public void afterTransactionCompletion Transaction tx if Iterator i Collection .iterator 260 APPENDIX A MORE ADVANCED FEATURES while Booking b Booking sendMail b null public boolean onSave Object entity Serializable id Object state String propertyNames Type types throws CallbackException Collection .add entity return false private void sendMail Booking b Here we would actually send out the e-mail Name Seat 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

Đã 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.