Commit c6c7242b authored by Matija Obreza's avatar Matija Obreza
Browse files

Updated HSQL Dialect with datediff() support

parent c43c3393
......@@ -18,8 +18,10 @@ package org.genesys.blocks.util;
import java.sql.Types;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.DoubleType;
import org.hibernate.type.StandardBasicTypes;
* Hibernate's HSQL dialect uses clob(255) when length is not specified.
......@@ -41,5 +43,7 @@ public class BetterHSQLDialect extends HSQLDialect {
registerColumnType(Types.BLOB, "blob");
registerFunction("stddev", new StandardSQLFunction("stddev_pop", DoubleType.INSTANCE));
registerKeyword("day"); // Needed for DATEDIFF(DAY, ...)
registerFunction("datediff", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datediff('day', ?1, ?2)"));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment