Following this example, if I attempt the following:

Field<Date> day = Factory.field("trunc({0}, {1})", SQLDataType.DATE,
THINGS.ENTRY_DATE, DatePart.DAY);

I get the following exception:

org.jooq.exception.SQLDialectNotSupportedException: Type class
org.jooq.DatePart is not supported in dialect null
at org.jooq.impl.AbstractDataType.getDataType(AbstractDataType.java:478)
at org.jooq.impl.FieldTypeHelper.getDataType(FieldTypeHelper.java:972)
at org.jooq.impl.Factory.getDataType(Factory.java:6245)
at org.jooq.impl.Util.queryParts(Util.java:533)
at org.jooq.impl.SQLField.<init>(SQLField.java:59)
at org.jooq.impl.Factory.field(Factory.java:1291)

I also tried this with Factory instance method, i.e.

Factory db = new Factory(ds, SQLDialect.HSQLDB);
Field<Date> day = db.field("trunc({0}, {1})", SQLDataType.DATE,
THINGS.ENTRY_DATE, DatePart.DAY);

and I got the same error.

Is there a better way to supply the dialect?

On Fri, Nov 23, 2012 at 12:20 PM, Lukas Eder <[email protected]> wrote:

> Factory.field("trunc({0}, {1})", SQLDataType.TIMESTAMP, date, datepart);

Reply via email to