Java 类org.hibernate.type.descriptor.sql.BasicBinder 实例源码

项目:lams    文件:AbstractHANADialect.java   
@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() );
            }

        }
    };
}
项目:lams    文件:AbstractHANADialect.java   
@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() );
            }

        }
    };
}
项目:lams    文件:AttributeConverterSqlTypeDescriptorAdapter.java   
@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 );
        }
    };
}
项目:windup-rulesets    文件:DstSafeDateTypeDescriptor.java   
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);  
   } 
  } 
 }; 
}
项目:lams    文件:PostgresUUIDType.java   
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() );
        }
    };
}
项目:hibernate-types    文件:ArraySqlTypeDescriptor.java   
@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)
            ));
        }
    };
}
项目:hibernate-types    文件:JsonBinarySqlTypeDescriptor.java   
@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());
        }
    };
}
项目:hibernate-types    文件:JsonStringSqlTypeDescriptor.java   
@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));
        }
    };
}
项目:hibernate-types    文件:ArraySqlTypeDescriptor.java   
@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)
            ));
        }
    };
}
项目:hibernate-types    文件:JsonBinarySqlTypeDescriptor.java   
@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());
        }
    };
}
项目:hibernate-types    文件:JsonStringSqlTypeDescriptor.java   
@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));
        }
    };
}
项目:uimaster    文件:SQLCETypeDescriptor.java   
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));
        }
    };
}