使用除SINGLE_TABLE以外的任何其他Hibernate继承策略时,JVM会崩溃 [英] JVM crashing when using any other Hibernate inheritance strategy besides SINGLE_TABLE

查看:109
本文介绍了使用除SINGLE_TABLE以外的任何其他Hibernate继承策略时,JVM会崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java(JRE 1.6.0_26-b03)中,我有两个类, SuperControl 及其子类 SubControl 。它们都需要是持久化对象,我使用Hibernate Annotations来实现这一点。我有大约210个正在被正确保存的类。



我的问题是除了<$ c $之外, SubControl 拒绝以任何方式继承C> SINGLE_TABLE 。当我说拒绝时,我的意思是整个JRE崩溃



这有点问题,因为我更喜欢 SuperControl 作为 SubControl 的映射超类。 SuperControl 也可以是一个持久的实体。奇怪的是,我在其他地方的代码中有一个完全平行的层次结构,正常工作。



这就是我想要的:

  @Entity 
@MappedSuperclass
公共类SuperControl扩展ItsSuperClass {
// ...
}

@Entity
public class SubControl extends SuperControl {
// ...
}

,但它弹出错误

 
#致命错误有已被Java运行时环境检测到:

#内部错误(c1_Optimizer.cpp:271),pid = 5456,tid = 1260
#guarantee(x_compare_res!=常量:: not_comparable)失败:IfOp中的不可比常量

#JRE版本:6.0_26-b03
#Java VM:Java HotSpot TM客户端VM(20.1-b02混合模式,共享windows-x86)
#包含更多信息的错误报告文件保存为:
#C:\eclipse\hs_err_pid5456.log

不提供y继承提示,Hibernate默认为 SINGLE_TABLE (我可以告诉你创建一个 DTYPE 列)。

  @Entity 
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class SuperControl extends ItsSuperClass {
// ...
}

@Entity
公共类SubControl扩展了SuperControl {
//。 ..
}

最糟糕的部分是如果我删除 SubControl 类ENTIRELY,或者甚至只是其在hibernate.cfg.xml文件中的映射,JVM 仍然崩溃。这导致我相信 SuperControl SubControl 之间存在某种隐藏的联系。也许是在Eclipse或类似的东西中缓存的东西。我重新启动了Eclipse,完成了几个清理和构建,甚至重新启动了我的机器,问题仍然存在。



有什么想法?



谢谢!

解决方案

试试Java 1.6.0_20,并检查是否可行。你已经发现了一个JVM错误,并且返回6个小版本可能足以让它运行。



你很幸运,这个错误是可重现的,所以创建一个最小的测试用例并将其发布到Oracle错误数据库。


Ok, this is probably a longshot but here goes.

In Java (JRE 1.6.0_26-b03) I have two classes, SuperControl and its subclass SubControl. They both need to be persistent objects and I'm using Hibernate Annotations to achieve this. I have approximately 210 classes that are being persisted correctly. Except one isn't.

My problem is that SubControl refuses to inherit in any way besides SINGLE_TABLE. When I say "refuses", I mean that the entire JRE crashes.

This is a bit problematic because I'd really prefer SuperControl to be a mapped superclass of SubControl. SuperControl can also be a persistent entity in its own right. The strange thing is that I have an exactly parallel hierarchy in my code elsewhere that works correctly.

This is what I want:

@Entity
@MappedSuperclass
public class SuperControl extends ItsSuperClass {
  // ...
}

@Entity
public class SubControl extends SuperControl {
  // ...
}

but it bombs out with the error

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (c1_Optimizer.cpp:271), pid=5456, tid=1260
#  guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) Client VM (20.1-b02 mixed mode, sharing windows-x86 )
# An error report file with more information is saved as:
# C:\eclipse\hs_err_pid5456.log

Without supplying any inheritance hint, Hibernate defaults to SINGLE_TABLE (which I can tell thanks to the creation of a DTYPE column). I can explicitly specify this without the JVM crashing.

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class SuperControl extends ItsSuperClass {
  // ...
}

@Entity
public class SubControl extends SuperControl {
  // ...
}

The worst part is that if I remove the SubControl class ENTIRELY, or even just its mapping in the hibernate.cfg.xml file, the JVM still crashes. This leads me to believe that there's some kind of hidden linkage between SuperControl and SubControl. Maybe something cached in Eclipse or the like. I've restarted Eclipse, done several clean-and-builds, and even restarted my machine, and the problem's still there.

Any ideas? I've been working on this for hours and have gotten nowhere.

Thanks!

解决方案

Try Java 1.6.0_20, and check if that works. You have found a JVM bug, and going back 6 minor versions might be enought to get this running.

You are lucky in the way that this bug is reproducable, so create a minimal testcase and post it to the Oracle bug database.

这篇关于使用除SINGLE_TABLE以外的任何其他Hibernate继承策略时,JVM会崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆