org.hibernate.type.descriptor.sql.BasicBinder Java Examples

The following examples show how to use org.hibernate.type.descriptor.sql.BasicBinder. 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));
        }
    };
}