Hi!

When I'm trying to insert geo data into PostGIS, JOOQ 3.5.4 throws a 
SQLDialectNotSupportedException: 

Not supported by dialect : Type class org.postgis.PGgeometry is not 
supported in dialect SQL99.

The relevant binding:

public class PositionBinding implements Binding<Object, Position> {

    private final Converter<Object, Position> converter = new 
PositionConverter();

    @Override
    public Converter<Object, Position> converter() {
        return converter;
    }

    @Override
    public void sql(BindingSQLContext<Position> ctx) throws SQLException {
        ctx.render().visit(DSL.val(ctx.convert(converter).value()));
    }

    @Override
    public void register(BindingRegisterContext<Position> ctx) throws 
SQLException {
        ctx.statement().registerOutParameter(ctx.index(), 
Types.JAVA_OBJECT);
    }

    @Override
    public void set(BindingSetStatementContext<Position> ctx) throws 
SQLException {
        ctx.statement().setObject(ctx.index(), 
ctx.convert(converter).value(), null);
    }

    @Override
    public void set(BindingSetSQLOutputContext<Position> 
bindingSetSQLOutputContext) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override
    public void get(BindingGetResultSetContext<Position> ctx) throws 
SQLException {
        
ctx.convert(converter).value(ctx.resultSet().getObject(ctx.index()));
    }

    @Override
    public void get(BindingGetStatementContext<Position> ctx) throws 
SQLException {
        
ctx.convert(converter).value(ctx.statement().getObject(ctx.index()));
    }

    @Override
    public void get(BindingGetSQLInputContext<Position> 
bindingGetSQLInputContext) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }
}

The converter just returns a PGgeometry which is a PGobject and registered 
with PostgreSQL's JDBC driver.

The field definition generated by JOOQ looks as follows:

createField("position", 
org.jooq.impl.DefaultDataType.getDefaultDataType("USER-DEFINED"), this, "", 
new PositionBinding());

Reading works.

I've read through old discussions and GitHub issues but wasn't able to 
solve the issue myself. The official documentation 
(http://www.jooq.org/doc/latest/manual/code-generation/custom-data-type-bindings/)
 
wasn't very helpful either. I would be very happy if someone could point me 
in the right direction.

Regards,
Andreas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to