HHH-11818 : ClassCastException when binding a MaterializedNClobType as NClob

This commit is contained in:
Gail Badner 2017-06-14 12:57:41 -07:00
parent 515e45e382
commit 3f2c36ab69
1 changed files with 6 additions and 3 deletions

View File

@ -48,12 +48,15 @@ public class StringTypeDescriptor extends AbstractTypeDescriptor<String> {
if ( CharacterStream.class.isAssignableFrom( type ) ) {
return (X) new CharacterStreamImpl( value );
}
if ( Clob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createClob( value );
}
// Since NClob extends Clob, we need to check if type is an NClob
// before checking if type is a Clob. That will ensure that
// the correct type is returned.
if ( DataHelper.isNClob( type ) ) {
return (X) options.getLobCreator().createNClob( value );
}
if ( Clob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createClob( value );
}
throw unknownUnwrap( type );
}