use of org.geolatte.geom.codec.db.db2.Db2ClobEncoder in project hibernate-orm by hibernate.
the class DB2GeometryTypeDescriptor method getBinder.
@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, toText(value, options));
}
@Override
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException {
st.setObject(name, toText(value, options));
}
private String toText(X value, WrapperOptions options) {
final Geometry<?> geometry = getJavaDescriptor().unwrap(value, Geometry.class, options);
final Db2ClobEncoder encoder = new Db2ClobEncoder();
String encoded = encoder.encode(geometry);
return encoded;
}
};
}
Aggregations