public void nullSafeSet(PreparedStatement statement,
Object value, int index) throws HibernateException, SQLException {
if (value == null) {
statement.setBytes(index, null);
} else {
BinaryWriter bw = new BinaryWriter();
byte[] bytes = bw.writeBinary((Geometry)value);
statement.setBytes(index, bytes);
}
}