@Override public <X> BasicBinder<X> getClobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>( javaTypeDescriptor, this ) { @Override protected void doBind(final PreparedStatement st, final X value, final int index, final WrapperOptions options) throws SQLException { final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options ); if ( value instanceof ClobImplementer ) { st.setCharacterStream( index, new CloseSuppressingReader( characterStream.asReader() ), characterStream.getLength() ); } else { st.setCharacterStream( index, characterStream.asReader(), characterStream.getLength() ); } } }; }
@Override public <X> BasicBinder<X> getNClobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>( javaTypeDescriptor, this ) { @Override protected void doBind(final PreparedStatement st, final X value, final int index, final WrapperOptions options) throws SQLException { final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options ); if ( value instanceof NClobImplementer ) { st.setCharacterStream( index, new CloseSuppressingReader( characterStream.asReader() ), characterStream.getLength() ); } else { st.setCharacterStream( index, characterStream.asReader(), characterStream.getLength() ); } } }; }
@Override @SuppressWarnings("unchecked") public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor) { // Get the binder for the intermediate type representation final ValueBinder realBinder = delegate.getBinder( intermediateJavaTypeDescriptor ); return new BasicBinder<X>( javaTypeDescriptor, this ) { @Override @SuppressWarnings("unchecked") protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { final Object convertedValue; try { convertedValue = converter.convertToDatabaseColumn( value ); } catch (PersistenceException pe) { throw pe; } catch (RuntimeException re) { throw new PersistenceException( "Error attempting to apply AttributeConverter", re ); } realBinder.bind( st, convertedValue, index, options ); } }; }
public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>(javaTypeDescriptor, (SqlTypeDescriptor) this) { @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { if (cal == null) { st.setDate(index, javaTypeDescriptor.unwrap(value, Date.class, options)); } else { st.setDate(index, javaTypeDescriptor.unwrap(value, Date.class, options), cal); } } }; }
public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>( javaTypeDescriptor, this ) { @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { st.setObject( index, javaTypeDescriptor.unwrap( value, UUID.class, options ), getSqlType() ); } }; }
@Override public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>(javaTypeDescriptor, this) { @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { AbstractArrayTypeDescriptor<Object> abstractArrayTypeDescriptor = (AbstractArrayTypeDescriptor<Object>) javaTypeDescriptor; st.setArray(index, st.getConnection().createArrayOf( abstractArrayTypeDescriptor.getSqlArrayType(), abstractArrayTypeDescriptor.unwrap(value, Object[].class, options) )); } }; }
@Override public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>(javaTypeDescriptor, this) { @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { st.setObject(index, javaTypeDescriptor.unwrap(value, JsonNode.class, options), getSqlType()); } }; }
@Override public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>(javaTypeDescriptor, this) { @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { st.setString(index, javaTypeDescriptor.unwrap(value, String.class, options)); } }; }
public <X> ValueBinder<X> getBinder( final JavaTypeDescriptor<X> javaTypeDescriptor) { return new BasicBinder<X>(javaTypeDescriptor, this) { @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { st.setInt(index, javaTypeDescriptor.unwrap(value, Integer.class, options)); } }; }