TAILIEUCHUNG - manning Hibernate in Action phần 7

Tham khảo tài liệu 'manning hibernate in action phần 7', 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ả | Understanding the Hibernate type system 205 D The UserType is responsible for dirty-checking property values. The equals method compares the current property value to a previous snapshot and determines whether the property is dirty and must by saved to the database. 0 The UserType is also partially responsible for creating the snapshot in the first place. Since MonetaryAmount is an immutable class the deepCopy method returns its argument. In the case of a mutable type it would need to return a copy of the argument to be used as the snapshot value. This method is also called when an instance of the type is written to or read from the second-level cache. F Hibernate can make some minor performance optimizations for immutable types like this one. The isMutable method tells Hibernate that this type is immutable. G The nullSafeGet method retrieves the property value from the JDBC ResultSet. You can also access the owner of the component if you need it for the conversion. All database values are in USD so you have to convert the MonetaryAmount returned by this method before you show it to the user. H The nullSafeSet method writes the property value to the JDBC PreparedState-ment. This method takes whatever currency is set and converts it to a simple BigDecimal USD value before saving. We now map the initialprice property of Item as follows property name initialPrice column INITIAL_PRICE type This is the simplest kind of transformation that a UserType could perform. Much more sophisticated things are possible. A custom mapping type could perform validation it could read and write data to and from an LDAP directory it could even retrieve persistent objects from a different Hibernate Session for a different database. You re limited mainly by your imagination We d prefer to represent both the amount and currency of our monetary amounts in the database especially if the schema isn t legacy but can be defined or updated quickly . We .

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.