寻找可变对象的 Hibernate UserType 方法的详细解释

发布于 2024-08-27 04:06:14 字数 457 浏览 2 评论 0原文

我正在 Hibernate 中创建一个自定义 UserType 类。具体案例是 HL7v3 临床文档(我在健康 IT 部门工作)。它是一个可变对象,并且大多数有关 Hibernate UserType 接口的文档似乎都以不可变类型为中心。我想更好地了解如何以及何时使用接口方法,特别是:

assemble - 为什么有两个参数(一个可序列化,一个对象)?该方法的用例是什么?

反汇编 - 我应该实现此方法来返回可序列化的形式(例如字符串表示形式)吗?该方法何时以及如何被调用?

equals - 这是为了更新吗?读?争论?脏读?大多数情况下简单地返回 false 会产生什么后果?

替换 - 我真的不明白三个对象参数来自哪里,何时调用此方法,以及 Hibernate 期望返回什么,或者如何使用该返回值。

任何指示将不胜感激。我已经搜索并阅读了有关该主题的所有内容,但没有找到太多解释这些方法如何用于可变对象的文档。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文