Affects Version/s: None
Fix Version/s: 3.0-RC1
Let's assume the user has three entities A, B, C where B and C specialize A.
When a user sets the inheritance mapping strategy to "subclass" (which really means <joined-subclass>) then the Spring cartridge correctly generates A.hbm.xml with
<class name="AImpl" table="A">
<joined-subclass name="BImpl" table="B">
<joined-subclass name="CImpl" table="C">
BUT: it also generates additional, superfluous files B.hbm.xml and C.hbm.xml! Hibernate schema mapper complains about "duplicate imports" for BImpl and CImpl.
Looking at the code for SpringEntityLogicImpl, there is a complex method that tries to guess whether a .hbm.xml file needs to be written or not:
protected boolean handleIsRootInheritanceEntity()
boolean result = false;
GeneralizableElementFacade superElement = this.getGeneralization();
if (superElement == null)
// We are a subclass
GeneralizableElementFacade root = getRootInheritanceEntity();
String inheritance = getInheritance(root);
// Are we the subclass element
result = root.getFullyQualifiedName().equals(
if (!result && inheritance != null
The bug seems to be in this method (I think it is somewhere in the "else" clause).
HOWEVER: I suggest to throw away this method and ALWAYS write one .hbm.xml file per class, using a different syntax. This syntax allows to use <subclass> and <joined-subclass> mapping elements in a separate mapping file (as a top level element, instead of <class>). You then have to declare the class that is extended (for example write a new file B.hbm.xml with:
<subclass name="B" extends="A">
This would be MUCH simpler, you can also throw away the getRootInheritanceEntity() method altogether. The price for this is: at runtime, you have to load A.hbm.xml before B.hbm.xml and C.hbm.xml.