Looking for detailed explanation of Hibernate UserType methods for mutable objects
- by Tom
I am creating a custom UserType class in Hibernate. The specific case is for an HL7v3 clinical document (I work in health IT). It is a mutable object and most of the documentation around the Hibernate UserType interface seems to center around immutable types. I want a better understanding of how and when the interface methods are used, specifically:
assemble - why two parameters (one Serializable, one Object)? What is the use case for this method?
disassemble - should I just implement this method to return a serializable form (e.g. String representation)? When and how is this method invoked?
equals - is this for update? read? contention? dirty reads? What are the consequences of simply returning false in most cases?
replace - I really don't understand where the three Object parameters come from, when this method is invoked, and what Hibernate expects to return, or how that return value is used.
Any pointers would be appreciated. I've searched and read all I can find on the subject, but have not found much documentation at all explaining how these methods are used for mutable objects.