org.hibernate.type.descriptor.ValueBinder Java Examples

The following examples show how to use org.hibernate.type.descriptor.ValueBinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArraySqlTypeDescriptor.java    From hibernate-types with Apache License 2.0 5 votes vote down vote up
@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)
            ));
        }
    };
}
 
Example #2
Source File: JsonBinarySqlTypeDescriptor.java    From hibernate-types with Apache License 2.0 5 votes vote down vote up
@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());
        }
    };
}
 
Example #3
Source File: JsonStringSqlTypeDescriptor.java    From hibernate-types with Apache License 2.0 5 votes vote down vote up
@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));
        }
    };
}
 
Example #4
Source File: ArraySqlTypeDescriptor.java    From hibernate-types with Apache License 2.0 5 votes vote down vote up
@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)
            ));
        }
    };
}
 
Example #5
Source File: JsonBinarySqlTypeDescriptor.java    From hibernate-types with Apache License 2.0 5 votes vote down vote up
@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());
        }
    };
}
 
Example #6
Source File: JsonStringSqlTypeDescriptor.java    From hibernate-types with Apache License 2.0 5 votes vote down vote up
@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));
        }
    };
}
 
Example #7
Source File: ClobTypeDescriptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor) {
	return getClobBinder( javaTypeDescriptor );
}
 
Example #8
Source File: NClobTypeDescriptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor) {
	return getNClobBinder( javaTypeDescriptor );
}
 
Example #9
Source File: SqlTypeDescriptor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the binder (setting JDBC in-going parameter values) capable of handling values of the type described by the
 * passed descriptor.
 *
 * @param javaTypeDescriptor The descriptor describing the types of Java values to be bound
 *
 * @return The appropriate binder.
 */
<X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor);