From 6d31022c4a57999c9863478ed562c4db1880d029 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 3 Oct 2007 06:16:46 +0000 Subject: [PATCH] HHH-2822 : added functions for SAPDBDialect git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14056 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../main/java/org/hibernate/dialect/SAPDBDialect.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java b/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java index 6f853047c4..232b6ff626 100644 --- a/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java +++ b/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java @@ -9,6 +9,7 @@ import org.hibernate.cfg.Environment; import org.hibernate.dialect.function.NoArgSQLFunction; import org.hibernate.dialect.function.StandardSQLFunction; import org.hibernate.dialect.function.VarArgsSQLFunction; +import org.hibernate.dialect.function.SQLFunctionTemplate; import org.hibernate.sql.CaseFragment; import org.hibernate.sql.DecodeCaseFragment; import org.hibernate.sql.OracleJoinFragment; @@ -74,6 +75,15 @@ public class SAPDBDialect extends Dialect { registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) ); registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) ); + registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "second(?1)") ); + registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "minute(?1)") ); + registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "hour(?1)") ); + registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "day(?1)") ); + registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "month(?1)") ); + registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "year(?1)") ); + + registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "?1(?3)") ); + registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) ); registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) ); registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );