Hello Yakov,
> I am using JOOQ as a DSL generator and I am trying to generate a
> TRUNCATE statement. However, it seems that it is only possibly to do
> that with a connection in place. I did notice that DELETE FROM works
> just fine. [...]
You're right, the bounds of the generic type <R> are inconsistent
between those two API methods. I guess it makes sense to relax the
bounds of <R> from TableRecord<R> to Record in the truncate method,
too.
In the mean time, you can resort to casting the table to the (Table) raw type:
Factory sqlFactory = new Factory(SQLDialect.SQLSERVER);
String sql = sqlFactory.truncate((Table) Factory.table("table")).getSQL();
I'll file this API change as #1408, to be implemented in jOOQ 2.4.0
https://sourceforge.net/apps/trac/jooq/ticket/1408
Thanks for reporting this!
Cheers
Lukas