Hello Robert,

2015-07-17 0:01 GMT+02:00 Robert DiFalco <[email protected]>:

> Also I just created a new column with type INTERVAL for PostgreSQL. The
> datatype that JOOQ generated was Object. Is that correct? I would have
> expected a Java Interval or a DayToSecond subclass.
>

Yes, unfortunately, we don't support that yet
https://github.com/jOOQ/jOOQ/issues/2230

For now, you'll have to create your own kind of data type binding for that:
http://www.jooq.org/doc/latest/manual/sql-building/queryparts/custom-bindings/

On Thu, Jul 16, 2015 at 1:46 PM, Robert DiFalco <[email protected]>
> wrote:
>
>> I'm about to do some schema changes to include time intervals (not
>> date-time intervals), but before I go to far I was wondering if JOOQ had
>> anything special to craft queries like this:
>>
>> select ...
>> from devices d
>> where (now() at time zone 'UTC' + make_interval(hours :=
>> d.utc_offset_hours))::time
>>     BETWEEN time '10:00' AND time '22:00';
>>
>>
>> I suppose at the very least I could make it a text string like this:
>>
>> "select ...
>> from devices d
>> where (now() at time zone 'UTC' + make_interval(hours :=
>> d.utc_offset_hours))::time
>>     BETWEEN time ?' AND time ?"
>>
>>
>> But it would be nice to be able to construct this query in a type-safe
>> way that would detect schema changes. Maybe there is and I just don't know
>> all the depths of JOOQ yet.
>>
>
That interval expression will need to go into your own plain SQL
implementation, I suspect. As usual, just wrap up that expression in a
template behind a static method. Have you tried that? I'm happy to help
with concrete issues that you may encounter

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/d/optout.

Reply via email to