Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.StandardSQLFunction


    getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
    //getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);

    getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", Hibernate.DOUBLE ) );
    registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", Hibernate.STRING ) );
    registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.STRING ) );
    registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", Hibernate.DOUBLE ) );
    registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "($length(?1)*8)" ) );
    // hibernate impelemnts cast in Dialect.java
    registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.INTEGER ) );
    registerFunction( "char", new StandardJDBCEscapeFunction( "char", Hibernate.CHARACTER ) );
    registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.INTEGER ) );
    registerFunction( "char_length", new StandardSQLFunction( "char_length", Hibernate.INTEGER ) );
    registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", Hibernate.DOUBLE ) );
    registerFunction( "coalesce", new VarArgsSQLFunction( "coalesce(", ",", ")" ) );
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "", "||", "" ) );
    registerFunction( "convert", new ConvertFunction() );
    registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", Hibernate.DATE ) );
    registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
    registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
    registerFunction(
        "current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", Hibernate.TIMESTAMP )
    );
    registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", Hibernate.TIME ) );
    registerFunction( "database", new StandardJDBCEscapeFunction( "database", Hibernate.STRING ) );
    registerFunction( "dateadd", new VarArgsSQLFunction( Hibernate.TIMESTAMP, "dateadd(", ",", ")" ) );
    registerFunction( "datediff", new VarArgsSQLFunction( Hibernate.INTEGER, "datediff(", ",", ")" ) );
    registerFunction( "datename", new VarArgsSQLFunction( Hibernate.STRING, "datename(", ",", ")" ) );
    registerFunction( "datepart", new VarArgsSQLFunction( Hibernate.INTEGER, "datepart(", ",", ")" ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", Hibernate.STRING ) );
    registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", Hibernate.INTEGER ) );
    registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", Hibernate.INTEGER ) );
    registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", Hibernate.INTEGER ) );
    // is it necessary to register %exact since it can only appear in a where clause?
    registerFunction( "%exact", new StandardSQLFunction( "%exact", Hibernate.STRING ) );
    registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "%external", new StandardSQLFunction( "%external", Hibernate.STRING ) );
    registerFunction( "$extract", new VarArgsSQLFunction( Hibernate.INTEGER, "$extract(", ",", ")" ) );
    registerFunction( "$find", new VarArgsSQLFunction( Hibernate.INTEGER, "$find(", ",", ")" ) );
    registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.INTEGER ) );
    registerFunction( "getdate", new StandardSQLFunction( "getdate", Hibernate.TIMESTAMP ) );
    registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "ifnull", new VarArgsSQLFunction( "ifnull(", ",", ")" ) );
    registerFunction( "%internal", new StandardSQLFunction( "%internal" ) );
    registerFunction( "isnull", new VarArgsSQLFunction( "isnull(", ",", ")" ) );
    registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", Hibernate.INTEGER ) );
    registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", Hibernate.STRING ) );
    registerFunction( "left", new StandardJDBCEscapeFunction( "left", Hibernate.STRING ) );
    registerFunction( "len", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
    registerFunction( "$length", new VarArgsSQLFunction( "$length(", ",", ")" ) );
    // aggregate functions shouldn't be registered, right?
    //registerFunction( "list", new StandardSQLFunction("list",Hibernate.STRING) );
    // stopped on $list
    registerFunction( "$list", new VarArgsSQLFunction( "$list(", ",", ")" ) );
    registerFunction( "$listdata", new VarArgsSQLFunction( "$listdata(", ",", ")" ) );
    registerFunction( "$listfind", new VarArgsSQLFunction( "$listfind(", ",", ")" ) );
    registerFunction( "$listget", new VarArgsSQLFunction( "$listget(", ",", ")" ) );
    registerFunction( "$listlength", new StandardSQLFunction( "$listlength", Hibernate.INTEGER ) );
    registerFunction( "locate", new StandardSQLFunction( "$FIND", Hibernate.INTEGER ) );
    registerFunction( "log", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "log10", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
    registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", Hibernate.DOUBLE ) );
    registerFunction( "month", new StandardJDBCEscapeFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", Hibernate.STRING ) );
    registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", Hibernate.TIMESTAMP ) );
    registerFunction( "nullif", new VarArgsSQLFunction( "nullif(", ",", ")" ) );
    registerFunction( "nvl", new NvlFunction() );
    registerFunction( "%odbcin", new StandardSQLFunction( "%odbcin" ) );
    registerFunction( "%odbcout", new StandardSQLFunction( "%odbcin" ) );
    registerFunction( "%pattern", new VarArgsSQLFunction( Hibernate.STRING, "", "%pattern", "" ) );
    registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", Hibernate.DOUBLE ) );
    registerFunction( "$piece", new VarArgsSQLFunction( Hibernate.STRING, "$piece(", ",", ")" ) );
    registerFunction( "position", new VarArgsSQLFunction( Hibernate.INTEGER, "position(", " in ", ")" ) );
    registerFunction( "power", new VarArgsSQLFunction( Hibernate.STRING, "power(", ",", ")" ) );
    registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", Hibernate.INTEGER ) );
    registerFunction( "repeat", new VarArgsSQLFunction( Hibernate.STRING, "repeat(", ",", ")" ) );
    registerFunction( "replicate", new VarArgsSQLFunction( Hibernate.STRING, "replicate(", ",", ")" ) );
    registerFunction( "right", new StandardJDBCEscapeFunction( "right", Hibernate.STRING ) );
    registerFunction( "round", new VarArgsSQLFunction( Hibernate.FLOAT, "round(", ",", ")" ) );
    registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
    registerFunction( "second", new StandardJDBCEscapeFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
    registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
    registerFunction( "%sqlstring", new VarArgsSQLFunction( Hibernate.STRING, "%sqlstring(", ",", ")" ) );
    registerFunction( "%sqlupper", new VarArgsSQLFunction( Hibernate.STRING, "%sqlupper(", ",", ")" ) );
    registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", Hibernate.DOUBLE ) );
    registerFunction( "%startswith", new VarArgsSQLFunction( Hibernate.STRING, "", "%startswith", "" ) );
    // below is for Cache' that don't have str in 2007.1 there is str and we register str directly
    registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as char varying)" ) );
    registerFunction( "string", new VarArgsSQLFunction( Hibernate.STRING, "string(", ",", ")" ) );
    // note that %string is deprecated
    registerFunction( "%string", new VarArgsSQLFunction( Hibernate.STRING, "%string(", ",", ")" ) );
    registerFunction( "substr", new VarArgsSQLFunction( Hibernate.STRING, "substr(", ",", ")" ) );
    registerFunction( "substring", new VarArgsSQLFunction( Hibernate.STRING, "substring(", ",", ")" ) );
    registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.TIMESTAMP, false ) );
    registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", Hibernate.DOUBLE ) );
    registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", Hibernate.DOUBLE ) );
    registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", Hibernate.DOUBLE ) );
    registerFunction( "tochar", new VarArgsSQLFunction( Hibernate.STRING, "tochar(", ",", ")" ) );
    registerFunction( "to_char", new VarArgsSQLFunction( Hibernate.STRING, "to_char(", ",", ")" ) );
    registerFunction( "todate", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
    registerFunction( "to_date", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
    registerFunction( "tonumber", new StandardSQLFunction( "tonumber" ) );
    registerFunction( "to_number", new StandardSQLFunction( "tonumber" ) );
    // TRIM(end_keyword string-expression-1 FROM string-expression-2)
    // use Hibernate implementation "From" is one of the parameters they pass in position ?3
    //registerFunction( "trim", new SQLFunctionTemplate(Hibernate.STRING, "trim(?1 ?2 from ?3)") );
    registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", Hibernate.STRING ) );
    registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", Hibernate.STRING ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    // %upper is deprecated
    registerFunction( "%upper", new StandardSQLFunction( "%upper" ) );
    registerFunction( "user", new StandardJDBCEscapeFunction( "user", Hibernate.STRING ) );
    registerFunction( "week", new StandardJDBCEscapeFunction( "user", Hibernate.INTEGER ) );
    registerFunction( "xmlconcat", new VarArgsSQLFunction( Hibernate.STRING, "xmlconcat(", ",", ")" ) );
    registerFunction( "xmlelement", new VarArgsSQLFunction( Hibernate.STRING, "xmlelement(", ",", ")" ) );
    // xmlforest requires a new kind of function constructor
View Full Code Here


    registerColumnType( Types.VARBINARY, "varchar($l) for bit data" );
    registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
    registerColumnType( Types.BLOB, "blob($l)" );
    registerColumnType( Types.CLOB, "clob($l)" );

    registerFunction("abs", new StandardSQLFunction("abs") );
    registerFunction("absval", new StandardSQLFunction("absval") );
    registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

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

    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("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction("float", new StandardSQLFunction("float", Hibernate.DOUBLE) );
    registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
    registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
    registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction("stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction("variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

    registerFunction("julian_day", new StandardSQLFunction("julian_day", Hibernate.INTEGER) );
    registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
    registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", Hibernate.INTEGER) );
    registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
    registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
    registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
    registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
    registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
    registerFunction("current_date", new NoArgSQLFunction("current date", Hibernate.DATE, false) );
    registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
    registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
    registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
    registerFunction("days", new StandardSQLFunction("days", Hibernate.LONG) );
    registerFunction("current_time", new NoArgSQLFunction("current time", Hibernate.TIME, false) );
    registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
    registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", Hibernate.TIMESTAMP, false) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
    registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", Hibernate.TIMESTAMP) );
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
    registerFunction("week_iso", new StandardSQLFunction("week_iso", Hibernate.INTEGER) );
    registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );

    registerFunction("double", new StandardSQLFunction("double", Hibernate.DOUBLE) );
    registerFunction("varchar", new StandardSQLFunction("varchar", Hibernate.STRING) );
    registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
    registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
    registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
    registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
    registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );

    registerFunction("digits", new StandardSQLFunction("digits", Hibernate.STRING) );
    registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
    registerFunction("upper", new StandardSQLFunction("upper") );
    registerFunction("lower", new StandardSQLFunction("lower") );
    registerFunction("ucase", new StandardSQLFunction("ucase") );
    registerFunction("lcase", new StandardSQLFunction("lcase") );
    registerFunction("length", new StandardSQLFunction("length", Hibernate.LONG) );
    registerFunction("ltrim", new StandardSQLFunction("ltrim") );
    registerFunction("rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "substr", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "posstr", new StandardSQLFunction( "posstr", Hibernate.INTEGER ) );

    registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "length(?1)*8" ) );
    registerFunction( "trim", new AnsiTrimEmulationFunction() );

    registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );

View Full Code Here

    registerColumnType( Types.VARBINARY, "bytea" );
    registerColumnType( Types.CLOB, "text" );
    registerColumnType( Types.BLOB, "oid" );
    registerColumnType( Types.NUMERIC, "numeric($p, $s)" );

    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( "cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction( "log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
    registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction( "cbrt", new StandardSQLFunction("cbrt", Hibernate.DOUBLE) );
    registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction( "radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction( "degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );

    registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
    registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

    registerFunction( "random", new NoArgSQLFunction("random", 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( "lower", new StandardSQLFunction("lower") );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
    registerFunction( "initcap", new StandardSQLFunction("initcap") );
    registerFunction( "to_ascii", new StandardSQLFunction("to_ascii") );
    registerFunction( "quote_ident", new StandardSQLFunction("quote_ident", Hibernate.STRING) );
    registerFunction( "quote_literal", new StandardSQLFunction("quote_literal", Hibernate.STRING) );
    registerFunction( "md5", new StandardSQLFunction("md5") );
    registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction( "length", new StandardSQLFunction("length", Hibernate.LONG) );
    registerFunction( "char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
    registerFunction( "bit_length", new StandardSQLFunction("bit_length", Hibernate.LONG) );
    registerFunction( "octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );

    registerFunction( "age", new StandardSQLFunction("age") );
    registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
    registerFunction( "current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false) );
    registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
    registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
    registerFunction( "localtime", new NoArgSQLFunction("localtime", Hibernate.TIME, false) );
    registerFunction( "localtimestamp", new NoArgSQLFunction("localtimestamp", Hibernate.TIMESTAMP, false) );
    registerFunction( "now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP) );
    registerFunction( "timeofday", new NoArgSQLFunction("timeofday", Hibernate.STRING) );

    registerFunction( "current_user", new NoArgSQLFunction("current_user", Hibernate.STRING, false) );
    registerFunction( "session_user", new NoArgSQLFunction("session_user", Hibernate.STRING, false) );
    registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
    registerFunction( "current_database", new NoArgSQLFunction("current_database", Hibernate.STRING, true) );
    registerFunction( "current_schema", new NoArgSQLFunction("current_schema", Hibernate.STRING, true) );
   
    registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
    registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.DATE) );
    registerFunction( "to_timestamp", new StandardSQLFunction("to_timestamp", Hibernate.TIMESTAMP) );
    registerFunction( "to_number", new StandardSQLFunction("to_number", Hibernate.BIG_DECIMAL) );

    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","||",")" ) );

    registerFunction( "locate", new PositionSubstringFunction() );
View Full Code Here

       
        // select topic, syntax from information_schema.help
        // where section like 'Function%' order by section, topic

//        registerFunction("abs", new StandardSQLFunction("abs"));
        registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE));
        registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE));
        registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE));
        registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE));
        registerFunction("bitand", new StandardSQLFunction("bitand", Hibernate.INTEGER));
        registerFunction("bitor", new StandardSQLFunction("bitor", Hibernate.INTEGER));
        registerFunction("bitxor", new StandardSQLFunction("bitxor", Hibernate.INTEGER));
        registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.DOUBLE));
        registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE));
        registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE));
        registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE));
        registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE));
        registerFunction("floor", new StandardSQLFunction("floor", Hibernate.DOUBLE));
        registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE));
        registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE));
//        registerFunction("mod", new StandardSQLFunction("mod", Hibernate.INTEGER));
        registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE));
        registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE));
        registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE));
        registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE));
        registerFunction("round", new StandardSQLFunction("round", Hibernate.DOUBLE));
        registerFunction("roundmagic", new StandardSQLFunction("roundmagic", Hibernate.DOUBLE));
        registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER));
        registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE));
//        registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE));
        registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE));
        registerFunction("truncate", new StandardSQLFunction("truncate", Hibernate.DOUBLE));

        registerFunction("compress", new StandardSQLFunction("compress", Hibernate.BINARY));
        registerFunction("expand", new StandardSQLFunction("compress", Hibernate.BINARY));
        registerFunction("decrypt", new StandardSQLFunction("decrypt", Hibernate.BINARY));
        registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.BINARY));
        registerFunction("hash", new StandardSQLFunction("hash", Hibernate.BINARY));

        registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER));
//        registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.INTEGER));
        registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER));
        registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "(", "||", ")"));
        registerFunction("difference", new StandardSQLFunction("difference", Hibernate.INTEGER));
        registerFunction("hextoraw", new StandardSQLFunction("hextoraw", Hibernate.STRING));
        registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
        registerFunction("insert", new StandardSQLFunction("lower", Hibernate.STRING));
        registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING));
//        registerFunction("length", new StandardSQLFunction("length", Hibernate.INTEGER));
//        registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER));
//        registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
        registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING));
        registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING));
        registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.INTEGER));
        registerFunction("position", new StandardSQLFunction("position", Hibernate.INTEGER));
        registerFunction("rawtohex", new StandardSQLFunction("rawtohex", Hibernate.STRING));
        registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING));
        registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING));
        registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING));
        registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING));
        registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING));
        registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING));
        registerFunction("stringencode", new StandardSQLFunction("stringencode", Hibernate.STRING));
        registerFunction("stringdecode", new StandardSQLFunction("stringdecode", Hibernate.STRING));
//        registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING));
//        registerFunction("upper", new StandardSQLFunction("upper", Hibernate.STRING));
        registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING));

        registerFunction("stringtoutf8", new StandardSQLFunction("stringtoutf8", Hibernate.BINARY));
        registerFunction("utf8tostring", new StandardSQLFunction("utf8tostring", Hibernate.STRING));

        registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE));
        registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME));
        registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP));
        registerFunction("datediff", new StandardSQLFunction("datediff", Hibernate.INTEGER));
        registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING));
        registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER));
        registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER));
        registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER));
//        registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER));
//        registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER));
//        registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER));
        registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING));
        registerFunction("quater", new StandardSQLFunction("quater", Hibernate.INTEGER));
//        registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER));
        registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER));
//        registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER));

        registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE));
        registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME));
        registerFunction("curtimestamp", new NoArgSQLFunction("curtimestamp", Hibernate.TIME));
View Full Code Here

    registerColumnType( Types.CLOB, "longtext" );
//    registerColumnType( Types.CLOB, 16777215, "mediumtext" );
//    registerColumnType( Types.CLOB, 65535, "text" );
    registerVarcharTypes();

    registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction("bin", new StandardSQLFunction("bin", Hibernate.STRING) );
    registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
    registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.LONG) );
    registerFunction("lcase", new StandardSQLFunction("lcase") );
    registerFunction("lower", new StandardSQLFunction("lower") );
    registerFunction("length", new StandardSQLFunction("length", Hibernate.LONG) );
    registerFunction("ltrim", new StandardSQLFunction("ltrim") );
    registerFunction("ord", new StandardSQLFunction("ord", Hibernate.INTEGER) );
    registerFunction("quote", new StandardSQLFunction("quote") );
    registerFunction("reverse", new StandardSQLFunction("reverse") );
    registerFunction("rtrim", new StandardSQLFunction("rtrim") );
    registerFunction("soundex", new StandardSQLFunction("soundex") );
    registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
    registerFunction("ucase", new StandardSQLFunction("ucase") );
    registerFunction("upper", new StandardSQLFunction("upper") );
    registerFunction("unhex", new StandardSQLFunction("unhex", Hibernate.STRING) );

    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("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction("crc32", new StandardSQLFunction("crc32", Hibernate.LONG) );
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
    registerFunction("log2", new StandardSQLFunction("log2", Hibernate.DOUBLE) );
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
    registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
    registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );

    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );

    registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.INTEGER) );
    registerFunction("ceil", new StandardSQLFunction("ceil", Hibernate.INTEGER) );
    registerFunction("floor", new StandardSQLFunction("floor", Hibernate.INTEGER) );
    registerFunction("round", new StandardSQLFunction("round", Hibernate.INTEGER) );

    registerFunction("datediff", new StandardSQLFunction("datediff", Hibernate.INTEGER) );
    registerFunction("timediff", new StandardSQLFunction("timediff", Hibernate.TIME) );
    registerFunction("date_format", new StandardSQLFunction("date_format", Hibernate.STRING) );

    registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE) );
    registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME) );
    registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
    registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false) );
    registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
    registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
    registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
    registerFunction("from_days", new StandardSQLFunction("from_days", Hibernate.DATE) );
    registerFunction("from_unixtime", new StandardSQLFunction("from_unixtime", Hibernate.TIMESTAMP) );
    registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
    registerFunction("last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
    registerFunction("localtime", new NoArgSQLFunction("localtime", Hibernate.TIMESTAMP) );
    registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", Hibernate.TIMESTAMP) );
    registerFunction("microseconds", new StandardSQLFunction("microseconds", Hibernate.INTEGER) );
    registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
    registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
    registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP) );
    registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
    registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
    registerFunction("sec_to_time", new StandardSQLFunction("sec_to_time", Hibernate.TIME) );
    registerFunction("sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP) );
    registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
    registerFunction("time_to_sec", new StandardSQLFunction("time_to_sec", Hibernate.INTEGER) );
    registerFunction("to_days", new StandardSQLFunction("to_days", Hibernate.LONG) );
    registerFunction("unix_timestamp", new StandardSQLFunction("unix_timestamp", Hibernate.LONG) );
    registerFunction("utc_date", new NoArgSQLFunction("utc_date", Hibernate.STRING) );
    registerFunction("utc_time", new NoArgSQLFunction("utc_time", Hibernate.STRING) );
    registerFunction("utc_timestamp", new NoArgSQLFunction("utc_timestamp", Hibernate.STRING) );
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
    registerFunction("weekday", new StandardSQLFunction("weekday", Hibernate.INTEGER) );
    registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );
    registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
    registerFunction("yearweek", new StandardSQLFunction("yearweek", Hibernate.INTEGER) );

    registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
    registerFunction("oct", new StandardSQLFunction("oct", Hibernate.STRING) );

    registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );
    registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.LONG) );

    registerFunction("bit_count", new StandardSQLFunction("bit_count", Hibernate.LONG) );
    registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.STRING) );
    registerFunction("md5", new StandardSQLFunction("md5", Hibernate.STRING) );
    registerFunction("sha1", new StandardSQLFunction("sha1", Hibernate.STRING) );
    registerFunction("sha", new StandardSQLFunction("sha", Hibernate.STRING) );

    registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );

    getDefaultProperties().setProperty(Environment.MAX_FETCH_DEPTH, "2");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
  }
View Full Code Here

    registerColumnType( Types.TIME, "time with time zone" );
    registerColumnType( Types.TIMESTAMP, "timestamp with time zone" );
    registerColumnType( Types.BLOB, "blob" );
    registerColumnType( Types.CLOB, "clob" );

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
    registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(hex(?1))*4" ) );
    registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
    registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
    registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
    registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
    registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
    registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
    registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
    registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
    registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
    registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
    registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
    registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
    registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
    registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
    registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
    registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
    registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
    registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
    registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
    registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
    registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
    registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
    registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
    registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
    registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
    registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
    registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
    registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
    registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
    registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
    //registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
    registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
    registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
    registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
    registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
    registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
    registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
    registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
    registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
    registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
  }
View Full Code Here

    registerColumnType( Types.TIME, "date" );
    registerColumnType( Types.TIMESTAMP, "date" );
    registerColumnType( Types.BLOB, "long byte" );
    registerColumnType( Types.CLOB, "long varchar" );

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
    registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
    registerFunction( "bit_length", new StandardSQLFunction( "bit_length" ) );
    registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
    registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
    registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
    registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
    registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
    registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
    registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
    registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
    registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
    registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
    registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
    registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
    registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
    registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
    registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
    registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
    registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
    registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
    registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
    registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
    registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
    registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
    registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
    registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
    registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
    registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
    registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
    registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
    registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
    registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
    registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
    registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
    registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
    registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
    registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
    registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
    registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
    registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
    registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
    registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
  }
View Full Code Here

    registerColumnType( Types.VARBINARY, "long byte" );
    registerColumnType( Types.NUMERIC, "fixed($p,$s)" );
    registerColumnType( Types.CLOB, "long varchar" );
    registerColumnType( Types.BLOB, "long byte" );
   
    registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

    registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction( "log", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
    registerFunction( "power", new StandardSQLFunction("power") );
    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( "cot", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
    registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
    registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
    registerFunction( "radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction( "degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
    registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE) );

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

    registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
    registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
    registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );

    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
    registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );

    registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
    registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
    registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
    registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
    registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
    registerFunction( "initcap", new StandardSQLFunction("initcap", Hibernate.STRING) );
    registerFunction( "lower", new StandardSQLFunction("lower", Hibernate.STRING) );
    registerFunction( "ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING) );
    registerFunction( "rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING) );
    registerFunction( "lfill", new StandardSQLFunction("ltrim", Hibernate.STRING) );
    registerFunction( "rfill", new StandardSQLFunction("rtrim", Hibernate.STRING) );
    registerFunction( "soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
    registerFunction( "upper", new StandardSQLFunction("upper", Hibernate.STRING) );
    registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.STRING) );
    registerFunction( "index", new StandardSQLFunction("index", Hibernate.INTEGER) );

    registerFunction( "value", new StandardSQLFunction( "value" ) );
   
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
    registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "locate", new StandardSQLFunction("index", Hibernate.INTEGER) );
    registerFunction( "coalesce", new StandardSQLFunction( "value" ) );

    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);

  }
View Full Code Here

    registerColumnType( Types.CLOB, "longtext" );
    registerColumnType( Types.CLOB, 16777215, "mediumtext" );
    registerColumnType( Types.CLOB, 65535, "text" );
    registerVarcharTypes();

    registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction("bin", new StandardSQLFunction("bin", Hibernate.STRING) );
    registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
    registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.LONG) );
    registerFunction("lcase", new StandardSQLFunction("lcase") );
    registerFunction("lower", new StandardSQLFunction("lower") );
    registerFunction("length", new StandardSQLFunction("length", Hibernate.LONG) );
    registerFunction("ltrim", new StandardSQLFunction("ltrim") );
    registerFunction("ord", new StandardSQLFunction("ord", Hibernate.INTEGER) );
    registerFunction("quote", new StandardSQLFunction("quote") );
    registerFunction("reverse", new StandardSQLFunction("reverse") );
    registerFunction("rtrim", new StandardSQLFunction("rtrim") );
    registerFunction("soundex", new StandardSQLFunction("soundex") );
    registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
    registerFunction("ucase", new StandardSQLFunction("ucase") );
    registerFunction("upper", new StandardSQLFunction("upper") );
    registerFunction("unhex", new StandardSQLFunction("unhex", Hibernate.STRING) );

    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("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction("crc32", new StandardSQLFunction("crc32", Hibernate.LONG) );
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
    registerFunction("log2", new StandardSQLFunction("log2", Hibernate.DOUBLE) );
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
    registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
    registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );

    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );

    registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.INTEGER) );
    registerFunction("ceil", new StandardSQLFunction("ceil", Hibernate.INTEGER) );
    registerFunction("floor", new StandardSQLFunction("floor", Hibernate.INTEGER) );
    registerFunction("round", new StandardSQLFunction("round") );

    registerFunction("datediff", new StandardSQLFunction("datediff", Hibernate.INTEGER) );
    registerFunction("timediff", new StandardSQLFunction("timediff", Hibernate.TIME) );
    registerFunction("date_format", new StandardSQLFunction("date_format", Hibernate.STRING) );

    registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE) );
    registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME) );
    registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
    registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false) );
    registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
    registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
    registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
    registerFunction("from_days", new StandardSQLFunction("from_days", Hibernate.DATE) );
    registerFunction("from_unixtime", new StandardSQLFunction("from_unixtime", Hibernate.TIMESTAMP) );
    registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
    registerFunction("last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
    registerFunction("localtime", new NoArgSQLFunction("localtime", Hibernate.TIMESTAMP) );
    registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", Hibernate.TIMESTAMP) );
    registerFunction("microseconds", new StandardSQLFunction("microseconds", Hibernate.INTEGER) );
    registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
    registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
    registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP) );
    registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
    registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
    registerFunction("sec_to_time", new StandardSQLFunction("sec_to_time", Hibernate.TIME) );
    registerFunction("sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP) );
    registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
    registerFunction("time_to_sec", new StandardSQLFunction("time_to_sec", Hibernate.INTEGER) );
    registerFunction("to_days", new StandardSQLFunction("to_days", Hibernate.LONG) );
    registerFunction("unix_timestamp", new StandardSQLFunction("unix_timestamp", Hibernate.LONG) );
    registerFunction("utc_date", new NoArgSQLFunction("utc_date", Hibernate.STRING) );
    registerFunction("utc_time", new NoArgSQLFunction("utc_time", Hibernate.STRING) );
    registerFunction("utc_timestamp", new NoArgSQLFunction("utc_timestamp", Hibernate.STRING) );
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
    registerFunction("weekday", new StandardSQLFunction("weekday", Hibernate.INTEGER) );
    registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );
    registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
    registerFunction("yearweek", new StandardSQLFunction("yearweek", Hibernate.INTEGER) );

    registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
    registerFunction("oct", new StandardSQLFunction("oct", Hibernate.STRING) );

    registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );
    registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.LONG) );

    registerFunction("bit_count", new StandardSQLFunction("bit_count", Hibernate.LONG) );
    registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.STRING) );
    registerFunction("md5", new StandardSQLFunction("md5", Hibernate.STRING) );
    registerFunction("sha1", new StandardSQLFunction("sha1", Hibernate.STRING) );
    registerFunction("sha", new StandardSQLFunction("sha", Hibernate.STRING) );

    registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );

    getDefaultProperties().setProperty(Environment.MAX_FETCH_DEPTH, "2");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
  }
View Full Code Here

        registerColumnType( Types.BLOB, "VARBINARY(4000000)" );
        registerColumnType( Types.CLOB, "VARCHAR(4000000)" );

    getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "concat", new StandardSQLFunction("concat", Hibernate.STRING) );
    registerFunction( "mod", new StandardSQLFunction("mod") );
    registerFunction( "to_char", new StandardSQLFunction("to_char",Hibernate.STRING) );
    registerFunction( "to_date", new StandardSQLFunction("to_date",Hibernate.TIMESTAMP) );
    registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP, false) );
    registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP, false) );
    registerFunction( "nvl", new StandardSQLFunction("nvl") );

  }
View Full Code Here

TOP

Related Classes of org.hibernate.dialect.function.StandardSQLFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.