Hello,

Indeed, you're not using the API correctly as it seems. DSL.val() is used
to construct bind values, but you're passing an expression
(DSL.timestampAdd(...)) to the method. This doesn't really make sense. I
suspect you may get what you need by simply removing DSL.val().

Instead of:

params.add(DSL.val(
    DSL.timestampAdd(DSL.currentTimestamp(), longValueHere,
DatePart.SECOND)));


Write:

params.add(
    DSL.timestampAdd(DSL.currentTimestamp(), longValueHere,
DatePart.SECOND));


Hope this helps,
Lukas

2015-06-06 17:17 GMT+02:00 <[email protected]>:

> I was working around an insert 'where not exists' API limitation that
> you've fixed in jooq 3.7.
> https://github.com/jOOQ/jOOQ/issues/3779
>
> I realized that if I use DSL.timestampAdd() while accumulating list items
> I would get a stacktrace indicating dateAdd was not supported. Example:
>
> List<Field<?>> params = new LinkedList<>();
> params.add(DSL.val(
>     DSL.timestampAdd(DSL.currentTimestamp(), longValueHere,
> DatePart.SECOND)));
>
> final SelectConditionStep<Record1<String>> notExistsSelect =
> context.select(TABLENAME.UUID).from(TABLENAME)
>                         .where(TABLENAME.FK_UUID.equal(fkUuid)
>                                 .and(TABLENAME.valueA.equal(valueA)));
>
> SelectConditionStep<Record> insertIntoSelect =
>     context.select(params).whereNotExists(notExistsSelect);
>
> context.insertInto(TABLENAME, fields).select(insertIntoSelect).execute();
>
> However, if I remove the 'whereNotExists' and just do a regular insert:
>
> context.insertInto(TABLENAME).
>                         .set(TABLENAME.COLNAME,
> DSL.timestampAdd(DSL.currentTimestamp(),
>                                 prodVisTtlSec, DatePart.SECOND))
>                         .execute();
>
> I do not get an error. I had assumed I was misusing the API and closed the
> issue. If this is not the case, I can reopen it.
>
>
>
> On Saturday, June 6, 2015 at 3:39:52 AM UTC-5, Lukas Eder wrote:
>>
>> Hello,
>>
>> I see you have also created this as an issue on GitHub:
>> https://github.com/jOOQ/jOOQ/issues/4370
>>
>> But you've deleted its contents. Were you able to resolve the issue, then?
>>
>> Cheers,
>> Lukas
>>
>> 2015-06-05 17:23 GMT+02:00 <[email protected]>:
>>
>>> I've been receiving intermittent exceptions using DSL.timestampAdd()
>>> with MySQL in Amazon RDS (MySQL 5.6.22).
>>>
>>> My function call looks like:
>>>
>>> List<Field<?>> params = new LinkedList<>();
>>>
>>> Long prodTtlSec = <SOME VALUE>;
>>>
>>> params.add(DSL.val(isPermanent ? null : 
>>> DSL.timestampAdd(DSL.currentTimestamp(), prodTtlSec, DatePart.SECOND)));
>>>
>>>
>>> org.jooq.exception.SQLDialectNotSupportedException: Type class
>>> org.jooq.impl.DateAdd is not supported in dialect DEFAULT
>>>     at
>>> org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:757)
>>> ~[1.0-20150604.201643-39/:na]
>>>     at
>>> org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:704)
>>> ~[1.0-20150604.201643-39/:na]
>>>     at org.jooq.impl.DSL.getDataType(DSL.java:13585)
>>> ~[1.0-20150604.201643-39/:na] at org.jooq.impl.DSL.val(DSL.java:11979)
>>> ~[1.0-20150604.201643-39/:na]
>>>     ............
>>>
>>> Relevant maven dependencies:
>>> jooq 3.6.1
>>> jooq-meta 3.6.1
>>> mysql-connector-java 5.1.35
>>>
>>> The stack trace only occurs sometimes in the same execution path. If
>>> anyone has ideas why this might occur sometimes or how to resolve it, I
>>> would really appreciate it.
>>>
>>>
>>>  --
>>> 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.
>

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