}
iter = persistentClass.getSubclassIterator();
int k = 0;
while ( iter.hasNext() ) {
Subclass sc = (Subclass) iter.next();
subclassClosure[k] = sc.getEntityName();
try {
if ( persistentClass.isPolymorphic() ) {
final Object discriminatorValue;
if ( explicitDiscriminatorColumnName != null ) {
if ( sc.isDiscriminatorValueNull() ) {
discriminatorValue = NULL_DISCRIMINATOR;
}
else if ( sc.isDiscriminatorValueNotNull() ) {
discriminatorValue = NOT_NULL_DISCRIMINATOR;
}
else {
try {
discriminatorValue = discriminatorType.stringToObject( sc.getDiscriminatorValue() );
}
catch (ClassCastException cce) {
throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() );
}
catch (Exception e) {
throw new MappingException( "Could not format discriminator value to SQL string", e);
}
}
}
else {
// we now use subclass ids that are consistent across all
// persisters for a class hierarchy, so that the use of
// "foo.class = Bar" works in HQL
discriminatorValue = sc.getSubclassId();
}
subclassesByDiscriminatorValue.put( discriminatorValue, sc.getEntityName() );
discriminatorValues[k] = discriminatorValue.toString();
int id = getTableId(
sc.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
),
subclassTableNameClosure