好的,这可能是一个远景,但这里有。
在 Java (JRE 1.6.0_26-b03) 中,我有两个类,SuperControl
它的子类SubControl
. 它们都需要是持久对象,我正在使用 Hibernate Annotations 来实现这一点。我有大约 210 个被正确保存的类。除了一个不是。
我的问题是SubControl
拒绝以任何方式继承SINGLE_TABLE
。当我说“拒绝”时,我的意思是整个 JRE 崩溃。
这有点问题,因为我真的更喜欢SuperControl
成为SubControl
. SuperControl
本身也可以是一个持久实体。奇怪的是,我在其他地方的代码中有一个完全平行的层次结构,可以正常工作。
这就是我要的:
@Entity
@MappedSuperclass
public class SuperControl extends ItsSuperClass {
// ...
}
@Entity
public class SubControl extends SuperControl {
// ...
}
但它因错误而爆炸
#
# 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
在不提供任何继承提示的情况下,Hibernate 默认为SINGLE_TABLE
(我可以通过创建DTYPE
列来判断)。我可以明确指定这一点,而不会导致 JVM 崩溃。
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class SuperControl extends ItsSuperClass {
// ...
}
@Entity
public class SubControl extends SuperControl {
// ...
}
最糟糕的是,如果我完全删除SubControl
该类,甚至只是删除它在 hibernate.cfg.xml 文件中的映射,JVM仍然会崩溃。SuperControl
这让我相信和之间存在某种隐藏的联系SubControl
。也许缓存在 Eclipse 之类的东西中。我重新启动了 Eclipse,完成了几次清理和构建,甚至重新启动了我的机器,但问题仍然存在。
有任何想法吗?我已经为此工作了几个小时,但一无所获。
谢谢!