Any time you're using one of PostgreSQL's extensions (hstore, PostGIS, etc)
you'll run into this problem
For PostgreSQL 9.1+ you can easily import them into your DB for example:
DROP DATABASE IF EXISTS testdb;
CREATE DATABASE testdb;
\c testdb;
BEGIN;
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;
CREATE SEQUENCE tp_sequence;
CREATE TABLE tp (
position_id bigint default nextval('tp_sequence'),
text varchar,
val1 interval,
val2 box,
val3 hstore,
geom_pos geometry(Point, 4326, 2),
PRIMARY KEY(position_id)
);
COMMIT;
Then the java code looks like
Point point = new Point(0, 0);
point.setSrid(4326);
PGgeometry PGgeomPoint = new PGgeometry(point);
TpRecord tp = new TpRecord();
tp.setGeomPos(PGgeomPoint);
tp.attach(create);
tp.store();
On Monday, February 25, 2013 9:32:21 AM UTC-5, Lukas Eder wrote:
>
> > Do you suppose you could give me a rundown of whats going on internally
> for
> > these objects on inserts?
>
> Hmm, the behaviour is rather unexpected if it isn't covered by jOOQ's
> integration test. I mean, you can probably assume that
> PreparedStatement.setObject() will be called by jOOQ to pass those PG*
> objects to JDBC. But there's no guarantee, as variable binding across
> all 14 SQL dialects has become a bit tricky inside of jOOQ.
>
> I'm not even sure if jOOQ converters could be used to add more
> certainty about jOOQ's behaviour here, as the JDBC data type would
> probably still be "Object" - I haven't tried this yet, though.
>
> > I would much rather be using Records than these
> > custom insert statements with casts. I keep running into problems out of
> > jOOQ, NullPointerExceptions (no idea) and other things.
>
> Yes, but unfortunately, I really can't give you any hints towards a
> sound solution yet.
>
> > If I may say, what we really need is a proper "ANY" type that can be
> used
> > with records, basically any time jOOQ runs into "USER-DEFINED" just use
> the
> > magic ANY type and ignore all the type BS Java side as the user is
> clearly
> > trying to do something crazy. There are already several checks for UDT,
> > cursor type, and such in the type system, but the current Postgres ANY
> type
> > is of type Object (SQL type OTHER) and then jOOQ insists incorrectly
> > somewhere, instead of just passing it through to the JDBC engine.
>
> OK, I wasn't aware of this "USER-DEFINED" pseudo-type. You're right,
> "ANY" would be a better match, here. Can you provide me with some
> minimal DDL to reproduce "USER-DEFINED"? I can then try to at least
> make *some* things work before PG* types are formally supported
>
> Cheers
> Lukas
>
--
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/groups/opt_out.