HHH-7889
Conflicts: hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java
This commit is contained in:
parent
9069d7aed9
commit
98e3b2ab97
|
@ -53,32 +53,6 @@ public abstract class ClobTypeDescriptor implements SqlTypeDescriptor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( rs.getClob( name ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getClob( index ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getClob( name ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protected abstract <X> BasicBinder<X> getClobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
|
||||
public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return getClobBinder( javaTypeDescriptor );
|
||||
}
|
||||
|
||||
public static final ClobTypeDescriptor DEFAULT =
|
||||
new ClobTypeDescriptor() {
|
||||
|
@ -86,6 +60,7 @@ public abstract class ClobTypeDescriptor implements SqlTypeDescriptor {
|
|||
SqlTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicBinder<X> getClobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||
@Override
|
||||
|
@ -99,10 +74,26 @@ public abstract class ClobTypeDescriptor implements SqlTypeDescriptor {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicExtractor<X> getClobExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
|
||||
if ( options.useStreamForLobBinding() ) {
|
||||
return STREAM_BINDING.getClobExtractor( javaTypeDescriptor ).doExtract( rs, name, options );
|
||||
}
|
||||
else {
|
||||
return CLOB_BINDING.getClobExtractor( javaTypeDescriptor ).doExtract( rs, name, options );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
public static final ClobTypeDescriptor CLOB_BINDING =
|
||||
new ClobTypeDescriptor() {
|
||||
@Override
|
||||
public <X> BasicBinder<X> getClobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||
@Override
|
||||
|
@ -112,10 +103,23 @@ public abstract class ClobTypeDescriptor implements SqlTypeDescriptor {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicExtractor<X> getClobExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>(javaTypeDescriptor, this) {
|
||||
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( rs.getClob( name ), options );
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
public static final ClobTypeDescriptor STREAM_BINDING =
|
||||
new ClobTypeDescriptor() {
|
||||
@Override
|
||||
public <X> BasicBinder<X> getClobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||
@Override
|
||||
|
@ -126,6 +130,32 @@ public abstract class ClobTypeDescriptor implements SqlTypeDescriptor {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicExtractor<X> getClobExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>(javaTypeDescriptor, this) {
|
||||
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( rs.getCharacterStream( name ), options );
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
protected abstract <X> BasicBinder<X> getClobBinder(JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
|
||||
protected abstract <X> BasicExtractor<X> getClobExtractor(JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return getClobBinder( javaTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||
return getClobExtractor( javaTypeDescriptor );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue