Hello,

Thanks for reporting this. We're aware of this situation and as you've
noticed, we're hoping to improve that with jOOQ 3.5's TypeProviders where
we expose the data serialisation / deserialisation through an SPI to
clients.

The specific issue of being able to integrate the TIMESTAMPTZ type has been
referred to before on this user group:
https://groups.google.com/d/msg/jooq-user/JYjdbV1KvT4/osD6JSGi9toJ

... or also on Stack Overflow (discussion in comments):
http://stackoverflow.com/q/25432514/521799

Unfortunately, right now, there is not a lot you can do short of patching
the relevant parts of

- org.jooq.impl.DefaultBindContext (serialisation)
- org.jooq.impl.Utils (deserialisation)
- org.jooq.impl.Val (variable inlining)

Since you're successful when operating on Strings instead of Timestamps,
you could try applying a type-rewrite for all relevant columns to VARCHAR:
http://www.jooq.org/doc/latest/manual/code-generation/data-type-rewrites

Perhaps, that'll work together with your Converter<String, DateTime>

Lukas

2014-09-24 18:20 GMT+02:00 Ian Phillips <[email protected]>:

> I know about using customTypes and forcedTypes to create my own custom
> type Converters, but even when doing this jooq makes some assumptions about
> the data type based on what it reads from the DB schema.
>
> Here's my situation: I have a column of type timestamptz (in Postgres) and
> I'd like to be able to represent it as an org.joda.time.DateTime object in
> my application code.
>
> What I really want to be able to do is this:
>
> public class DateTimeConverter implements Converter<String, DateTime> {
>
>     private static final DateTimeFormatter dateTimeFormatter = new
> DateTimeFormatterBuilder()
>             // ...
>             .toFormatter();
>
>     @Override
>     public DateTime from(String databaseObject) {
>         return databaseObject != null ? DateTime.parse(databaseObject) :
> null;
>     }
>
>     @Override
>     public String to(DateTime userObject) {
>         return userObject != null ? userObject.toString(dateTimeFormatter)
> : null;
>     }
>     // ...
> }
>
> But of course this doesn't work as jooq tries to give me a
> java.sql.Timestamp object to work with. If I'm using raw JDBC I have no
> trouble calling rs.getString instead of rs.getTimestamp but there doesn't
> seem to be a way to tell jooq to do the same.
>
> I've noticed that there seem to be some data type related changes coming
> in 3.5.0, am I basically hosed until then?
>
> Cheers,
> Ian.
>
> --
> 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.
>

-- 
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