HHH-11818 : ClassCastException when binding a MaterializedNClobType as NClob
(cherry picked from commit 3f2c36ab69
)
This commit is contained in:
parent
8701d1044c
commit
473f43cdd5
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue