if ( q != null ) {
Type type = q.getDiscriminatorType();
String stringValue = q.getDiscriminatorSQLValue();
// Convert the string value into the proper type.
if ( type instanceof NullableType ) {
NullableType nullableType = ( NullableType ) type;
value = nullableType.fromStringValue( stringValue );
}
else {
throw new QueryException( "Unsupported discriminator type " + type );
}
return new TypedValue(