HHH-7066 More code taking advantage from the Clob extraction

This commit is contained in:
Sanne Grinovero 2012-02-14 16:39:16 +00:00
parent 98082feb11
commit f9ab0eb6ae
3 changed files with 4 additions and 24 deletions

View File

@ -103,12 +103,7 @@ public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Charact
return wrapChars( ( (String) value ).toCharArray() );
}
if ( Clob.class.isInstance( value ) ) {
try {
return wrapChars( DataHelper.extractString( ( (Clob) value ).getCharacterStream() ).toCharArray() );
}
catch ( SQLException e ) {
throw new HibernateException( "Unable to access lob stream", e );
}
return wrapChars( DataHelper.extractString( ( (Clob) value ) ).toCharArray() );
}
if ( Reader.class.isInstance( value ) ) {
return wrapChars( DataHelper.extractString( (Reader) value ).toCharArray() );

View File

@ -70,12 +70,7 @@ public class ClobTypeDescriptor extends AbstractTypeDescriptor<Clob> {
}
public String toString(Clob value) {
try {
return DataHelper.extractString( value.getCharacterStream() );
}
catch ( SQLException e ) {
throw new HibernateException( "Unable to access clob stream", e );
}
return DataHelper.extractString( value );
}
public Clob fromString(String string) {
@ -109,12 +104,7 @@ public class ClobTypeDescriptor extends AbstractTypeDescriptor<Clob> {
}
if ( CharacterStream.class.isAssignableFrom( type ) ) {
try {
return (X) new CharacterStreamImpl( DataHelper.extractString( value.getCharacterStream() ) );
}
catch ( SQLException e ) {
throw new HibernateException( "Unable to access lob stream", e );
}
return (X) new CharacterStreamImpl( DataHelper.extractString( value ) );
}
final Clob clob = WrappedClob.class.isInstance( value )

View File

@ -103,12 +103,7 @@ public class PrimitiveCharacterArrayTypeDescriptor extends AbstractTypeDescripto
return ( (String) value ).toCharArray();
}
if ( Clob.class.isInstance( value ) ) {
try {
return DataHelper.extractString( ( (Clob) value ).getCharacterStream() ).toCharArray();
}
catch ( SQLException e ) {
throw new HibernateException( "Unable to access lob stream", e );
}
return DataHelper.extractString( ( (Clob) value ) ).toCharArray();
}
if ( Reader.class.isInstance( value ) ) {
return DataHelper.extractString( ( (Reader) value ) ).toCharArray();