【问题标题】:Hibernate replication issues - does the session really need to be replicated?休眠复制问题——会话真的需要被复制吗?
【发布时间】:2012-01-14 07:54:19
【问题描述】:

我在对象更新时尝试复制 Hibernate 二级缓存键时发现了一个奇怪的情况。

缓存键结构是这样的:

cacheKey = {org.hibernate.cache.CacheKey}
|- key = {my.own.serializable.class}
|- type = {org.hibernate.type.ComponentType}
| |- typeScope = {org.hibernate.type.TypeFactory$TypeScopeImpl}
| | |- factory = {org.hibernate.impl.SessionFactoryImpl}
| |- propertyNames = {...}
| |- propertyTypes = {...}
| |- propertyNullability = {...}
| |- propertySpan = 2
| |- cascade = {...}
| |- joinedFetch = {...}
| |- isKey = true
| |- tuplizerMapping = {...}
|- entityOrRoleName = {java.lang.String} "my.Entity"
|- entityMode = {org.hibernate.EntityMode}
|- hashCode = 588688

我在这里看到的问题是cacheKey.type.typeScope 引用了本地o.h.i.SessionFactoryImpl,它会被复制过来。 typeScope(或其祖先之一)是否应该被声明为瞬态?

查看o.h.t.ComponentType 类我可以看到typeScope 属性在该类中根本没有使用,而只是在构造函数中设置并保留在其中。这是一个Hibernate 错误吗?

注意:o.h.t.ComponentType 在实体具有复合键并为其使用特殊标识符对象时使用。

我们使用 Hibernate v3.6.7 和 Ehcache v2.4.4。这也发布在Hibernate Users forum

编辑: 我打开了HHH-6880,到目前为止没有太大的成功。

我还向Ehcache users mailing list 发布了类似的消息,Alex@Terracotta 表示这是一个真正的问题,可能是由 HHH-5182 在 3.6 版中引入的,并且还会影响诸如 Ehcache 序列化到磁盘之类的事情。这是hibernate-dev thread的链接。

【问题讨论】:

    标签: java hibernate persistence ehcache


    【解决方案1】:

    Hibernate 团队似乎认为这已在 4.0.1 中通过修复 HHH-6822 得到解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-18
      • 2012-09-12
      • 1970-01-01
      • 2017-11-19
      相关资源
      最近更新 更多