小编Joh*_*ree的帖子

创建自定义Hibernate UserType - isMutable()是什么意思?

我在Hibernate中为项目创建自定义UserType.在我找到isMutable方法之前,它一直相对简单.我试图找出这种方法的含义,合同方式.

这是否意味着我创建UserType的类是不可变的,或者它是否意味着持有对此类的实例的引用的对象永远不会指向不同的实例?

我在Hibernate Community Wiki中找到了一些它们返回true的例子,因为对象本身是可变的 - http://www.hibernate.org/73.html.

社区维基中的其他示例返回false而没有解决原因,即使它们也是可变的.

我检查了JavaDoc,但它也不是很清楚.

从JavaDoc for UserType:

public boolean isMutable()
    Are objects of this type mutable?
    Returns:
        boolean
Run Code Online (Sandbox Code Playgroud)

从JavaDoc for Type:

public boolean isMutable()
    Are objects of this type mutable. (With respect to the referencing
    object ... entities and collections are considered immutable because
    they manage their own internal state.)
    Returns:
        boolean
Run Code Online (Sandbox Code Playgroud)

java orm hibernate

8
推荐指数
1
解决办法
8932
查看次数

标签 统计

hibernate ×1

java ×1

orm ×1