List of usage examples for org.hibernate.dialect.function SQLFunctionTemplate SQLFunctionTemplate
public SQLFunctionTemplate(Type type, String template)
From source file:org.n52.sos.config.sqlite.HibernateSQLiteDialect.java
License:Open Source License
public HibernateSQLiteDialect() { registerColumnType(Types.BIT, "integer"); registerColumnType(Types.TINYINT, "tinyint"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.INTEGER, "integer"); registerColumnType(Types.BIGINT, "bigint"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.REAL, "real"); registerColumnType(Types.DOUBLE, "double"); registerColumnType(Types.NUMERIC, "numeric"); registerColumnType(Types.DECIMAL, "decimal"); registerColumnType(Types.CHAR, "char"); registerColumnType(Types.VARCHAR, "varchar"); registerColumnType(Types.LONGVARCHAR, "longvarchar"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); registerColumnType(Types.TIMESTAMP, "timestamp"); registerColumnType(Types.BINARY, "blob"); registerColumnType(Types.VARBINARY, "blob"); registerColumnType(Types.LONGVARBINARY, "blob"); registerColumnType(Types.BLOB, "blob"); registerColumnType(Types.CLOB, "clob"); registerColumnType(Types.BOOLEAN, "integer"); registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "")); registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2")); registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); sqliteUniqueDelegate = new SQLiteUniqueDelegate(this); }
From source file:org.ng200.openolympus.OpenOlympusPostgreDialect.java
License:Open Source License
public OpenOlympusPostgreDialect() { super();//from www . j a v a 2 s . c o m this.registerFunction("add_time", new SQLFunctionTemplate(StandardBasicTypes.TIMESTAMP, "?1 + ?2 * INTERVAL '1 MILLISECOND'")); }
From source file:org.openbravo.advpaymentmngt.utility.APRMApplicationInitializer.java
License:Open Source License
@Override public void initialize() { OBDal.getInstance().registerSQLFunction("ad_message_get2", new StandardSQLFunction("ad_message_get2", StandardBasicTypes.STRING)); OBDal.getInstance().registerSQLFunction("hqlagg", new SQLFunctionTemplate(StandardBasicTypes.STRING, getAggregationSQL())); OBDal.getInstance().registerSQLFunction("get_uuid", new StandardSQLFunction("get_uuid", StandardBasicTypes.STRING)); }
From source file:org.smallmind.persistence.orm.hibernate.H2Dialect.java
License:Open Source License
public H2Dialect() { super();/*from w ww . j av a 2 s .co m*/ registerColumnType(Types.LONGVARCHAR, "clob"); registerFunction("org_smallmind_day_diff", new SQLFunctionTemplate(IntegerType.INSTANCE, "timestampdiff(SQL_TSI_DAY, ?1, ?2)")); registerFunction("org_smallmind_date_sub_minutes", new SQLFunctionTemplate(TimestampType.INSTANCE, "timstampadd(SQL_TSI_MINUTE, -?2, ?1)")); }
From source file:org.smallmind.persistence.orm.hibernate.HSQLDialect.java
License:Open Source License
public HSQLDialect() { super();//from www .j a v a 2 s . c om registerColumnType(Types.LONGVARCHAR, "clob"); registerFunction("org_smallmind_day_diff", new SQLFunctionTemplate(IntegerType.INSTANCE, "timestampdiff(SQL_TSI_DAY, ?1, ?2)")); registerFunction("org_smallmind_date_sub_minutes", new SQLFunctionTemplate(TimestampType.INSTANCE, "timstampadd(SQL_TSI_MINUTE, -?2, ?1)")); }
From source file:org.smallmind.persistence.orm.hibernate.MySQL5InnoDBDialect.java
License:Open Source License
public MySQL5InnoDBDialect() { super();//from w w w . j a v a 2 s.c om registerColumnType(Types.BOOLEAN, "BIT(1)"); registerFunction("org_smallmind_day_diff", new SQLFunctionTemplate(IntegerType.INSTANCE, "datediff(?2, ?1)")); registerFunction("org_smallmind_date_sub_minutes", new SQLFunctionTemplate(TimestampType.INSTANCE, "date_sub(?1, INTERVAL ?2 MINUTE)")); }
From source file:org.sqlite.hibernate.SQLiteDialect.java
License:Open Source License
public SQLiteDialect() { super();//w ww . j a v a2 s .co m registerColumnType(Types.BIT, "integer"); registerColumnType(Types.TINYINT, "tinyint"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.INTEGER, "integer"); registerColumnType(Types.BIGINT, "bigint"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.REAL, "real"); registerColumnType(Types.DOUBLE, "double"); registerColumnType(Types.NUMERIC, "numeric"); registerColumnType(Types.DECIMAL, "decimal"); registerColumnType(Types.CHAR, "char"); registerColumnType(Types.VARCHAR, "varchar"); registerColumnType(Types.LONGVARCHAR, "longvarchar"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); registerColumnType(Types.TIMESTAMP, "timestamp"); registerColumnType(Types.BINARY, "blob"); registerColumnType(Types.VARBINARY, "blob"); registerColumnType(Types.LONGVARBINARY, "blob"); // registerColumnType(Types.NULL, "null"); registerColumnType(Types.BLOB, "blob"); registerColumnType(Types.CLOB, "clob"); registerColumnType(Types.BOOLEAN, "integer"); registerFunction("concat", new VarArgsSQLFunction(STRING, "", "||", "")); registerFunction("mod", new SQLFunctionTemplate(INTEGER, "?1 % ?2")); registerFunction("substr", new StandardSQLFunction("substr", STRING)); registerFunction("substring", new StandardSQLFunction("substr", STRING)); }
From source file:org.unitime.commons.hibernate.util.HibernateUtil.java
License:Open Source License
public static void addBitwiseOperationsToDialect() { SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor) new _RootDAO().getSession() .getSessionFactory();/*from ww w . j ava 2 s .c o m*/ Dialect dialect = hibSessionFactory.getDialect(); if (!dialect.getFunctions().containsKey("bit_and")) { if (isOracle()) dialect.getFunctions().put("bit_and", new StandardSQLFunction("bitand", IntegerType.INSTANCE)); else dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 & ?2")); } }
From source file:org.wallride.autoconfigure.ExtendedMySQL5InnoDBDialect.java
License:Apache License
public ExtendedMySQL5InnoDBDialect() { super();/*from w ww .j a v a2 s . c om*/ registerFunction("regexp", new SQLFunctionTemplate(StandardBasicTypes.BOOLEAN, "?1 REGEXP ?2")); }
From source file:sam_testclient.utilities.SQLiteDialect.java
public SQLiteDialect() { registerColumnType(Types.BIT, "integer"); registerColumnType(Types.TINYINT, "tinyint"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.INTEGER, "integer"); registerColumnType(Types.BIGINT, "bigint"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.REAL, "real"); registerColumnType(Types.DOUBLE, "double"); registerColumnType(Types.NUMERIC, "numeric"); registerColumnType(Types.DECIMAL, "decimal"); registerColumnType(Types.CHAR, "char"); registerColumnType(Types.VARCHAR, "varchar"); registerColumnType(Types.LONGVARCHAR, "longvarchar"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); registerColumnType(Types.TIMESTAMP, "timestamp"); registerColumnType(Types.BINARY, "blob"); registerColumnType(Types.VARBINARY, "blob"); registerColumnType(Types.LONGVARBINARY, "blob"); // registerColumnType(Types.NULL, "null"); registerColumnType(Types.BLOB, "blob"); registerColumnType(Types.CLOB, "clob"); registerColumnType(Types.BOOLEAN, "integer"); registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "")); registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2")); registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); }