I have a jOOQ field declared like this (this is an over simplification):
field("INTERVAL '{0} minutes'", Duration.class, X)
I expected that to generate a Duration with X minutes that I could use in my queries, but instead it generated a duration of 0 minutes all the time. I inspected the generated SQL with toString and I saw instead of the expected INTERVAL '30 minutes' jOOQ generated INTERVAL '{0} minutes', so, it's treating {0} as a literal instead of replacing it by the template variable.
This is how I tested, this:
using(configuration).select(field("INTERVAL '30 minutes'", Duration.class)).toString()
yields:
select INTERVAL '30 minutes'
Whereas this:
using(configuration).select(field("INTERVAL '{0} minutes'", Duration.class, 30)).toString()
yields:
select INTERVAL '{0} minutes'
Is there a workaround to this behaviour?