org.hibernate.dialect.function.NvlFunction Java Examples

The following examples show how to use org.hibernate.dialect.function.NvlFunction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PostgresPlusDialect.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a PostgresPlusDialect
 */
public PostgresPlusDialect() {
	super();

	registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
	registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
	registerFunction( "soundex", new StandardSQLFunction( "soundex" ) );
	registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
	registerFunction( "rowid", new NoArgSQLFunction( "rowid", StandardBasicTypes.LONG, false ) );
	registerFunction( "rownum", new NoArgSQLFunction( "rownum", StandardBasicTypes.LONG, false ) );
	registerFunction( "instr", new StandardSQLFunction( "instr", StandardBasicTypes.INTEGER ) );
	registerFunction( "lpad", new StandardSQLFunction( "lpad", StandardBasicTypes.STRING ) );
	registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
	registerFunction( "rpad", new StandardSQLFunction( "rpad", StandardBasicTypes.STRING ) );
	registerFunction( "translate", new StandardSQLFunction( "translate", StandardBasicTypes.STRING ) );
	registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
	registerFunction( "coalesce", new NvlFunction() );
	registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.FLOAT ) );
	registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
	registerFunction( "nvl", new StandardSQLFunction( "nvl" ) );
	registerFunction( "nvl2", new StandardSQLFunction( "nvl2" ) );
	registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.FLOAT ) );
	registerFunction( "add_months", new StandardSQLFunction( "add_months", StandardBasicTypes.DATE ) );
	registerFunction( "months_between", new StandardSQLFunction( "months_between", StandardBasicTypes.FLOAT ) );
	registerFunction( "next_day", new StandardSQLFunction( "next_day", StandardBasicTypes.DATE ) );
}
 
Example #2
Source File: InformixDialect.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates new <code>InformixDialect</code> instance. Sets up the JDBC /
 * Informix type mappings.
 */
public InformixDialect() {
	super();

	registerColumnType( Types.BIGINT, "int8" );
	registerColumnType( Types.BINARY, "byte" );
	// Informix doesn't have a bit type
	registerColumnType( Types.BIT, "smallint" );
	registerColumnType( Types.CHAR, "char($l)" );
	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.DECIMAL, "decimal" );
	registerColumnType( Types.DOUBLE, "float" );
	registerColumnType( Types.FLOAT, "smallfloat" );
	registerColumnType( Types.INTEGER, "integer" );
	// or BYTE
	registerColumnType( Types.LONGVARBINARY, "blob" );
	// or TEXT?
	registerColumnType( Types.LONGVARCHAR, "clob" );
	// or MONEY
	registerColumnType( Types.NUMERIC, "decimal" );
	registerColumnType( Types.REAL, "smallfloat" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.TIMESTAMP, "datetime year to fraction(5)" );
	registerColumnType( Types.TIME, "datetime hour to second" );
	registerColumnType( Types.TINYINT, "smallint" );
	registerColumnType( Types.VARBINARY, "byte" );
	registerColumnType( Types.VARCHAR, "varchar($l)" );
	registerColumnType( Types.VARCHAR, 255, "varchar($l)" );
	registerColumnType( Types.VARCHAR, 32739, "lvarchar($l)" );

	registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
	registerFunction( "substring", new SQLFunctionTemplate(StandardBasicTypes.STRING, "substring(?1 FROM ?2 FOR ?3)"));
	registerFunction( "substr", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substr(?1, ?2, ?3)"));
	registerFunction( "coalesce", new NvlFunction());
	registerFunction( "nvl", new NvlFunction());
	registerFunction( "current_timestamp", new NoArgSQLFunction( "current", StandardBasicTypes.TIMESTAMP, false ) );
	registerFunction( "current_date", new NoArgSQLFunction( "today", StandardBasicTypes.DATE, false ) );

	uniqueDelegate = new InformixUniqueDelegate( this );
}
 
Example #3
Source File: Oracle8iDialect.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected void registerFunctions() {
	registerFunction( "abs", new StandardSQLFunction("abs") );
	registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );

	registerFunction( "acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
	registerFunction( "asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
	registerFunction( "atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
	registerFunction( "bitand", new StandardSQLFunction("bitand") );
	registerFunction( "cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
	registerFunction( "cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE) );
	registerFunction( "exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
	registerFunction( "ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
	registerFunction( "sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
	registerFunction( "sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
	registerFunction( "stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE) );
	registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
	registerFunction( "tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
	registerFunction( "tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE) );
	registerFunction( "variance", new StandardSQLFunction("variance", StandardBasicTypes.DOUBLE) );

	registerFunction( "round", new StandardSQLFunction("round") );
	registerFunction( "trunc", new StandardSQLFunction("trunc") );
	registerFunction( "ceil", new StandardSQLFunction("ceil") );
	registerFunction( "floor", new StandardSQLFunction("floor") );

	registerFunction( "chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
	registerFunction( "initcap", new StandardSQLFunction("initcap") );
	registerFunction( "lower", new StandardSQLFunction("lower") );
	registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
	registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
	registerFunction( "soundex", new StandardSQLFunction("soundex") );
	registerFunction( "upper", new StandardSQLFunction("upper") );
	registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );

	registerFunction( "to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
	registerFunction( "to_date", new StandardSQLFunction("to_date", StandardBasicTypes.TIMESTAMP) );

	registerFunction( "current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false) );
	registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIME, false) );
	registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false) );

	registerFunction( "last_day", new StandardSQLFunction("last_day", StandardBasicTypes.DATE) );
	registerFunction( "sysdate", new NoArgSQLFunction("sysdate", StandardBasicTypes.DATE, false) );
	registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", StandardBasicTypes.TIMESTAMP, false) );
	registerFunction( "uid", new NoArgSQLFunction("uid", StandardBasicTypes.INTEGER, false) );
	registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false) );

	registerFunction( "rowid", new NoArgSQLFunction("rowid", StandardBasicTypes.LONG, false) );
	registerFunction( "rownum", new NoArgSQLFunction("rownum", StandardBasicTypes.LONG, false) );

	// Multi-param string dialect functions...
	registerFunction( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
	registerFunction( "instr", new StandardSQLFunction("instr", StandardBasicTypes.INTEGER) );
	registerFunction( "instrb", new StandardSQLFunction("instrb", StandardBasicTypes.INTEGER) );
	registerFunction( "lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING) );
	registerFunction( "replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING) );
	registerFunction( "rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING) );
	registerFunction( "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING) );
	registerFunction( "substrb", new StandardSQLFunction("substrb", StandardBasicTypes.STRING) );
	registerFunction( "translate", new StandardSQLFunction("translate", StandardBasicTypes.STRING) );

	registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
	registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "instr(?2,?1)" ) );
	registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "vsize(?1)*8" ) );
	registerFunction( "coalesce", new NvlFunction() );

	// Multi-param numeric dialect functions...
	registerFunction( "atan2", new StandardSQLFunction("atan2", StandardBasicTypes.FLOAT) );
	registerFunction( "log", new StandardSQLFunction("log", StandardBasicTypes.INTEGER) );
	registerFunction( "mod", new StandardSQLFunction("mod", StandardBasicTypes.INTEGER) );
	registerFunction( "nvl", new StandardSQLFunction("nvl") );
	registerFunction( "nvl2", new StandardSQLFunction("nvl2") );
	registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT) );

	// Multi-param date dialect functions...
	registerFunction( "add_months", new StandardSQLFunction("add_months", StandardBasicTypes.DATE) );
	registerFunction( "months_between", new StandardSQLFunction("months_between", StandardBasicTypes.FLOAT) );
	registerFunction( "next_day", new StandardSQLFunction("next_day", StandardBasicTypes.DATE) );

	registerFunction( "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
}
 
Example #4
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4.0 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example #5
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example #6
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
	LOG.info("GemFireXDDialect for Hibernate 3.6 initialized.");
	    
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("concat", new DerbyConcatFunction());
	
               registerFunction("value", new StandardSQLFunction("coalesce"));
               registerFunction("nvl", new NvlFunction());
               registerFunction("groups", new StandardSQLFunction("GROUPS",
                   StandardBasicTypes.STRING));
               registerFunction("dsid", new StandardSQLFunction("DSID",
                   StandardBasicTypes.STRING));
               registerFunction("groupsintersection", new StandardSQLFunction(
                   "GROUPSINTERSECTION", StandardBasicTypes.STRING));
               registerFunction("groupsintersect", new StandardSQLFunction(
                   "GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
               registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                   StandardBasicTypes.STRING));
               registerFunction("longint", new StandardSQLFunction("bigint",
                   StandardBasicTypes.LONG));
               registerFunction("int", new StandardSQLFunction("integer",
                   StandardBasicTypes.INTEGER));
               registerFunction("pi", new StandardSQLFunction("pi",
                   StandardBasicTypes.DOUBLE));
               registerFunction("random", new NoArgSQLFunction("random",
                   StandardBasicTypes.DOUBLE));
               registerFunction("rand", new StandardSQLFunction("rand",
                   StandardBasicTypes.DOUBLE));// override
               registerFunction("sinh", new StandardSQLFunction("sinh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("cosh", new StandardSQLFunction("cosh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("tanh", new StandardSQLFunction("tanh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("user", new NoArgSQLFunction("USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current isolation", new NoArgSQLFunction(
                   "CURRENT ISOLATION", StandardBasicTypes.STRING, false));
               registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                   StandardBasicTypes.STRING, false));
               registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                   StandardBasicTypes.STRING, false));
               registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                   StandardBasicTypes.STRING, false));
               registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                   StandardBasicTypes.NUMERIC_BOOLEAN));
               registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                   StandardBasicTypes.TEXT));
               registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                   StandardBasicTypes.STRING));
               registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                   StandardBasicTypes.STRING));
               registerFunction("get_current_connection", new NoArgSQLFunction(
                   "GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
               registerFunction("identity_val_local", new NoArgSQLFunction(
                   "IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example #7
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
		super();
	        LOG.info("GemFireXDDialect for Hibernate 3 initialized.");
	              
/*		registerFunction("trim", new AnsiTrimFunction());
		registerFunction("concat", new DerbyConcatFunction());*/

                registerFunction("value", new StandardSQLFunction("coalesce"));
                registerFunction("nvl", new NvlFunction());
                registerFunction("groups", new StandardSQLFunction("GROUPS",
                    Hibernate.STRING));
                registerFunction("dsid", new StandardSQLFunction("DSID", Hibernate.STRING));
                registerFunction("groupsintersection", new StandardSQLFunction(
                    "GROUPSINTERSECTION", Hibernate.STRING));
                registerFunction("groupsintersect", new StandardSQLFunction(
                    "GROUPSINTERSECT", Hibernate.BOOLEAN));
                registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                    Hibernate.STRING));
                registerFunction("longint", new StandardSQLFunction("bigint",
                    Hibernate.LONG));
                registerFunction("int", new StandardSQLFunction("integer",
                    Hibernate.INTEGER));
                registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE));
                registerFunction("random", new NoArgSQLFunction("random", Hibernate.DOUBLE));
                registerFunction("rand", new StandardSQLFunction("rand", Hibernate.DOUBLE));// override
                registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE));
                registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE));
                registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE));
                registerFunction("user", new NoArgSQLFunction("USER", Hibernate.STRING,
                    false));
                registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                    Hibernate.STRING, false));
                registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                    Hibernate.STRING, false));
                registerFunction("current isolation", new NoArgSQLFunction(
                    "CURRENT ISOLATION", Hibernate.STRING, false));
                registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                    Hibernate.STRING, false));
                registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                    Hibernate.STRING, false));
                registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                    Hibernate.STRING, false));
                registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                    Hibernate.BOOLEAN));
                registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                    Hibernate.TEXT));
                registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                    Hibernate.STRING));
                registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                    Hibernate.STRING));
                registerFunction("get_current_connection", new NoArgSQLFunction(
                    "GET_CURRENT_CONNECTION", Hibernate.BINARY, true));
                registerFunction("identity_val_local", new NoArgSQLFunction(
                    "IDENTITY_VAL_LOCAL", Hibernate.BINARY, true));
	}
 
Example #8
Source File: Oracle8iDialect.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected void registerFunctions() {
	registerFunction( "abs", new StandardSQLFunction("abs") );
	registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

	registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
	registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
	registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
	registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
	registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
	registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
	registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
	registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
	registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
	registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
	registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
	registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
	registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
	registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

	registerFunction( "round", new StandardSQLFunction("round") );
	registerFunction( "trunc", new StandardSQLFunction("trunc") );
	registerFunction( "ceil", new StandardSQLFunction("ceil") );
	registerFunction( "floor", new StandardSQLFunction("floor") );

	registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
	registerFunction( "initcap", new StandardSQLFunction("initcap") );
	registerFunction( "lower", new StandardSQLFunction("lower") );
	registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
	registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
	registerFunction( "soundex", new StandardSQLFunction("soundex") );
	registerFunction( "upper", new StandardSQLFunction("upper") );
	registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
	registerFunction( "length", new StandardSQLFunction("length", Hibernate.LONG) );

	registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
	registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );

	registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
	registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
	registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );

	registerFunction( "lastday", new StandardSQLFunction("lastday", Hibernate.DATE) );
	registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
	registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
	registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
	registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );

	registerFunction( "rowid", new NoArgSQLFunction("rowid", Hibernate.LONG, false) );
	registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, false) );

	// Multi-param string dialect functions...
	registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
	registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
	registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
	registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
	registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
	registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
	registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
	registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
	registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );

	registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
	registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
	registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
	registerFunction( "coalesce", new NvlFunction() );

	// Multi-param numeric dialect functions...
	registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.FLOAT) );
	registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
	registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
	registerFunction( "nvl", new StandardSQLFunction("nvl") );
	registerFunction( "nvl2", new StandardSQLFunction("nvl2") );
	registerFunction( "power", new StandardSQLFunction("power", Hibernate.FLOAT) );

	// Multi-param date dialect functions...
	registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
	registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
	registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );

	registerFunction( "str", new StandardSQLFunction("to_char", Hibernate.STRING) );
}
 
Example #9
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4.0 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example #10
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example #11
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
	LOG.info("GemFireXDDialect for Hibernate 3.6 initialized.");
	    
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("concat", new DerbyConcatFunction());
	
               registerFunction("value", new StandardSQLFunction("coalesce"));
               registerFunction("nvl", new NvlFunction());
               registerFunction("groups", new StandardSQLFunction("GROUPS",
                   StandardBasicTypes.STRING));
               registerFunction("dsid", new StandardSQLFunction("DSID",
                   StandardBasicTypes.STRING));
               registerFunction("groupsintersection", new StandardSQLFunction(
                   "GROUPSINTERSECTION", StandardBasicTypes.STRING));
               registerFunction("groupsintersect", new StandardSQLFunction(
                   "GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
               registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                   StandardBasicTypes.STRING));
               registerFunction("longint", new StandardSQLFunction("bigint",
                   StandardBasicTypes.LONG));
               registerFunction("int", new StandardSQLFunction("integer",
                   StandardBasicTypes.INTEGER));
               registerFunction("pi", new StandardSQLFunction("pi",
                   StandardBasicTypes.DOUBLE));
               registerFunction("random", new NoArgSQLFunction("random",
                   StandardBasicTypes.DOUBLE));
               registerFunction("rand", new StandardSQLFunction("rand",
                   StandardBasicTypes.DOUBLE));// override
               registerFunction("sinh", new StandardSQLFunction("sinh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("cosh", new StandardSQLFunction("cosh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("tanh", new StandardSQLFunction("tanh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("user", new NoArgSQLFunction("USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current isolation", new NoArgSQLFunction(
                   "CURRENT ISOLATION", StandardBasicTypes.STRING, false));
               registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                   StandardBasicTypes.STRING, false));
               registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                   StandardBasicTypes.STRING, false));
               registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                   StandardBasicTypes.STRING, false));
               registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                   StandardBasicTypes.NUMERIC_BOOLEAN));
               registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                   StandardBasicTypes.TEXT));
               registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                   StandardBasicTypes.STRING));
               registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                   StandardBasicTypes.STRING));
               registerFunction("get_current_connection", new NoArgSQLFunction(
                   "GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
               registerFunction("identity_val_local", new NoArgSQLFunction(
                   "IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example #12
Source File: GemFireXDDialect.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
		super();
	        LOG.info("GemFireXDDialect for Hibernate 3 initialized.");
	              
/*		registerFunction("trim", new AnsiTrimFunction());
		registerFunction("concat", new DerbyConcatFunction());*/

                registerFunction("value", new StandardSQLFunction("coalesce"));
                registerFunction("nvl", new NvlFunction());
                registerFunction("groups", new StandardSQLFunction("GROUPS",
                    Hibernate.STRING));
                registerFunction("dsid", new StandardSQLFunction("DSID", Hibernate.STRING));
                registerFunction("groupsintersection", new StandardSQLFunction(
                    "GROUPSINTERSECTION", Hibernate.STRING));
                registerFunction("groupsintersect", new StandardSQLFunction(
                    "GROUPSINTERSECT", Hibernate.BOOLEAN));
                registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                    Hibernate.STRING));
                registerFunction("longint", new StandardSQLFunction("bigint",
                    Hibernate.LONG));
                registerFunction("int", new StandardSQLFunction("integer",
                    Hibernate.INTEGER));
                registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE));
                registerFunction("random", new NoArgSQLFunction("random", Hibernate.DOUBLE));
                registerFunction("rand", new StandardSQLFunction("rand", Hibernate.DOUBLE));// override
                registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE));
                registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE));
                registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE));
                registerFunction("user", new NoArgSQLFunction("USER", Hibernate.STRING,
                    false));
                registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                    Hibernate.STRING, false));
                registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                    Hibernate.STRING, false));
                registerFunction("current isolation", new NoArgSQLFunction(
                    "CURRENT ISOLATION", Hibernate.STRING, false));
                registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                    Hibernate.STRING, false));
                registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                    Hibernate.STRING, false));
                registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                    Hibernate.STRING, false));
                registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                    Hibernate.BOOLEAN));
                registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                    Hibernate.TEXT));
                registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                    Hibernate.STRING));
                registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                    Hibernate.STRING));
                registerFunction("get_current_connection", new NoArgSQLFunction(
                    "GET_CURRENT_CONNECTION", Hibernate.BINARY, true));
                registerFunction("identity_val_local", new NoArgSQLFunction(
                    "IDENTITY_VAL_LOCAL", Hibernate.BINARY, true));
	}