SpeedoDiscriminator sd = sc.inheritance.discriminator;
String filter = null;
if (sd.expression != null) {
filter = sd.expression;
} else if (sd.elements.size() == 1) {
SpeedoElement se = (SpeedoElement) sd.elements.get(0);
if (se instanceof SpeedoField) {
filter = ((SpeedoField) se).name;
} else if (se instanceof SpeedoNoFieldColumn) {
filter = HIDDEN_FIELD_CLASS_NAME;
} else {
throw new SpeedoException("Unmanaged filter element: " + se);
}
} else {
throw new SpeedoException(
"Composite inheritance discriminator not yet supported in Speedo");
}
if (filter != null) {
sc.jormclass.setInheritanceFilter(nd, filter);
logger.log(BasicLevel.DEBUG, "Assign filter: " + filter);
}
if (sc.inheritance.discriminator.elements != null
&& sc.inheritance.discriminator.elements.size() == 1) {
SpeedoElement se = (SpeedoElement) sc.inheritance.discriminator.elements.get(0);
if (se instanceof SpeedoNoFieldColumn) {
if (sc.getSuper() == null) {
// The discriminator is a column not mapped to a
// persistent field. then we have to create a constant
// hidden field.