JVM crashing when using any other Hibernate inheritance strategy besides SINGLE_TABLE
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!
This looks like a bug 7042153, aka 2210012 reported in early May.
Note the workaround offered by one user: using the "-server" JVM option fixed it for them.
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.
精彩评论