HHH-18480 ClassCastException when updating a Blob with Oracle
This commit is contained in:
parent
6cc292e9d3
commit
d8ad674e7f
|
@ -132,10 +132,7 @@ public class BlobJavaType extends AbstractClassJavaType<Blob> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( Blob.class.isAssignableFrom( type ) ) {
|
else if ( Blob.class.isAssignableFrom( type ) ) {
|
||||||
final Blob blob = value instanceof WrappedBlob
|
return (X) getOrCreateBlob( value, options );
|
||||||
? ( (WrappedBlob) value ).getWrappedBlob()
|
|
||||||
: getOrCreateBlob(value, options);
|
|
||||||
return (X) blob;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( SQLException e ) {
|
catch ( SQLException e ) {
|
||||||
|
@ -146,6 +143,9 @@ public class BlobJavaType extends AbstractClassJavaType<Blob> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Blob getOrCreateBlob(Blob value, WrapperOptions options) throws SQLException {
|
private Blob getOrCreateBlob(Blob value, WrapperOptions options) throws SQLException {
|
||||||
|
if ( value instanceof WrappedBlob ) {
|
||||||
|
value = ( (WrappedBlob) value ).getWrappedBlob();
|
||||||
|
}
|
||||||
if ( options.getDialect().useConnectionToCreateLob() ) {
|
if ( options.getDialect().useConnectionToCreateLob() ) {
|
||||||
if ( value.length() == 0 ) {
|
if ( value.length() == 0 ) {
|
||||||
// empty Blob
|
// empty Blob
|
||||||
|
|
|
@ -105,10 +105,7 @@ public class ClobJavaType extends AbstractClassJavaType<Clob> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( Clob.class.isAssignableFrom( type ) ) {
|
else if ( Clob.class.isAssignableFrom( type ) ) {
|
||||||
final Clob clob = value instanceof WrappedClob
|
return (X) getOrCreateClob( value, options );
|
||||||
? ( (WrappedClob) value ).getWrappedClob()
|
|
||||||
: getOrCreateClob(value, options);
|
|
||||||
return (X) clob;
|
|
||||||
}
|
}
|
||||||
else if ( String.class.isAssignableFrom( type ) ) {
|
else if ( String.class.isAssignableFrom( type ) ) {
|
||||||
if (value instanceof ClobImplementer) {
|
if (value instanceof ClobImplementer) {
|
||||||
|
@ -129,6 +126,9 @@ public class ClobJavaType extends AbstractClassJavaType<Clob> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Clob getOrCreateClob(Clob value, WrapperOptions options) throws SQLException {
|
private Clob getOrCreateClob(Clob value, WrapperOptions options) throws SQLException {
|
||||||
|
if ( value instanceof WrappedClob ) {
|
||||||
|
value = ( (WrappedClob) value ).getWrappedClob();
|
||||||
|
}
|
||||||
if ( options.getDialect().useConnectionToCreateLob() ) {
|
if ( options.getDialect().useConnectionToCreateLob() ) {
|
||||||
if ( value.length() == 0 ) {
|
if ( value.length() == 0 ) {
|
||||||
// empty Clob
|
// empty Clob
|
||||||
|
|
|
@ -104,10 +104,7 @@ public class NClobJavaType extends AbstractClassJavaType<NClob> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( NClob.class.isAssignableFrom( type ) ) {
|
else if ( NClob.class.isAssignableFrom( type ) ) {
|
||||||
final NClob nclob = value instanceof WrappedNClob
|
return (X) getOrCreateNClob( value, options );
|
||||||
? ( (WrappedNClob) value ).getWrappedNClob()
|
|
||||||
: getOrCreateNClob(value, options);
|
|
||||||
return (X) nclob;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( SQLException e ) {
|
catch ( SQLException e ) {
|
||||||
|
@ -118,6 +115,9 @@ public class NClobJavaType extends AbstractClassJavaType<NClob> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private NClob getOrCreateNClob(NClob value, WrapperOptions options) throws SQLException {
|
private NClob getOrCreateNClob(NClob value, WrapperOptions options) throws SQLException {
|
||||||
|
if ( value instanceof WrappedNClob ) {
|
||||||
|
value = ( (WrappedNClob) value ).getWrappedNClob();
|
||||||
|
}
|
||||||
if ( options.getDialect().useConnectionToCreateLob() ) {
|
if ( options.getDialect().useConnectionToCreateLob() ) {
|
||||||
if ( value.length() == 0 ) {
|
if ( value.length() == 0 ) {
|
||||||
// empty NClob
|
// empty NClob
|
||||||
|
@ -132,7 +132,6 @@ public class NClobJavaType extends AbstractClassJavaType<NClob> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public <X> NClob wrap(X value, WrapperOptions options) {
|
public <X> NClob wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue