Oh yeah, and since it wouldn't fit in the subject, I'm also using a mixture of hbm.xml's and annotations. Apparently, I'm a glutton for punishment.
I don't have the exact code at the moment, so I'm going to try to explain approximately what I'm trying to do.
Following 5 classes (pseudoish-code)
Code:
public class Obj {
@Id
Integer id;
// key is a formula, which ends up being the name
// of the module this moudelinst is an instance of.
// this mapping is done in hbm.xml
Map<String,Moduleinst> moduleinstMap;
}
public class Module{
@Id
Integer id;
@Column(...)
String name;
}
@DiscriminatorFormula( /* name from corresponding module */ )
public class ModuleInst {
@Id
Integer id;
@Column(...)
Obj obj;
@Column(...)
Module module;
}
@DiscriminatorValue("ModuleA")
public class ModuleA extends ModuleInst{
Object moduleASpecialItem;
}
@DiscriminatorValue("ModuleinstB")
public class ModuleInstB extends ModuleInst{
Object moduleBSpecialItem;
}
Most of the time, the map on Obj works wonderfully and the entities in the map are of the discriminated classes. On occasion though, *some* of them are instead an object of type (something like:) Moduleinst_123_somethingsomething, or something like that. IIRC, this is a class generated by Hibernate (by means of other library). why is this happening? Also, just to throw some extra mess into the equation: ModuleA and ModuleB are actually defined in a separate (JBoss Seam Web App) project.
Any help would be wonderful! Thank you!