Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.StandardSQLFunction


        registerColumnType(Types.BLOB, "blob"); //$NON-NLS-1$
        registerColumnType(Types.VARBINARY, "blob"); //$NON-NLS-1$
        registerColumnType(Types.CLOB, "clob"); //$NON-NLS-1$
        registerColumnType(Types.JAVA_OBJECT, "object"); //$NON-NLS-1$
       
        registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("ceil", new StandardSQLFunction("ceiling")); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("floor", new StandardSQLFunction("floor")); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatbigdecimal", new StandardSQLFunction("formatbigdecimal", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatbiginteger", new StandardSQLFunction("formatbiginteger", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatdouble", new StandardSQLFunction("formatdouble", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatfloat", new StandardSQLFunction("formatfloat", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatinteger", new StandardSQLFunction("formatinteger", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatlong", new StandardSQLFunction("formatlong", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("mod", new StandardSQLFunction("mod")); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsebigdecimal", new StandardSQLFunction("parsebigdecimal", Hibernate.BIG_DECIMAL)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsebiginteger", new StandardSQLFunction("parsebiginteger", Hibernate.BIG_INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsedouble", new StandardSQLFunction("parsedouble", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsefloat", new StandardSQLFunction("parsefloat", Hibernate.FLOAT)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parseinteger", new StandardSQLFunction("parseinteger", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parselong", new StandardSQLFunction("parselong", Hibernate.LONG)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("round", new StandardSQLFunction("round")); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$

        registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        registerFunction("initcap", new StandardSQLFunction("initcap", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("insert", new StandardSQLFunction("insert", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("lpad", new StandardSQLFunction("lpad", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("rpad", new StandardSQLFunction("rpad", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("translate", new StandardSQLFunction("translate", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$

        registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formatdate", new StandardSQLFunction("formatdate", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formattime", new StandardSQLFunction("formattime", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("formattimestamp", new StandardSQLFunction("formattimestamp", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsedate", new StandardSQLFunction("parsedate", Hibernate.DATE)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsetime", new StandardSQLFunction("parsetime", Hibernate.TIME)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("parsetimestamp", new StandardSQLFunction("parsetimestamp", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("timestampcreate", new StandardSQLFunction("timestampcreate", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("timestampAdd", new StandardSQLFunction("timestampAdd")); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("timestampDiff", new StandardSQLFunction("timestampDiff", Hibernate.LONG)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("modifytimezone", new StandardSQLFunction("modifytimezone", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$

        registerFunction("convert", new StandardSQLFunction("convert")); //$NON-NLS-1$ //$NON-NLS-2$
       
        registerFunction("to_bytes", new StandardSQLFunction("to_bytes", Hibernate.BLOB)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("to_chars", new StandardSQLFunction("to_chars", Hibernate.CLOB)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("from_unittime", new StandardSQLFunction("from_unittime", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("session_id", new StandardSQLFunction("session_id", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
       
        registerFunction("uuid", new StandardSQLFunction("uuid", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("unescape", new StandardSQLFunction("unescape", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
       
        registerFunction("array_get", new StandardSQLFunction("uuid", Hibernate.OBJECT)); //$NON-NLS-1$ //$NON-NLS-2$
        registerFunction("array_length", new StandardSQLFunction("unescape", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here


                registerColumnType( Types.BLOB, "longvarbinary" );
                registerColumnType( Types.CLOB, "longvarchar" );
                registerColumnType( Types.LONGVARBINARY, "longvarbinary" );
                registerColumnType( Types.LONGVARCHAR, "longvarchar" );

                registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
                registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
                registerFunction( "lower", new StandardSQLFunction( "lower" ) );
                registerFunction( "upper", new StandardSQLFunction( "upper" ) );
                registerFunction( "lcase", new StandardSQLFunction( "lcase" ) );
                registerFunction( "ucase", new StandardSQLFunction( "ucase" ) );
                registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
                registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
                registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
                registerFunction( "reverse", new StandardSQLFunction( "reverse" ) );
                registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
                registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex" ) );
                registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw" ) );

                registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
                registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );

                registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
                registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
                registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false ) );
                registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
                registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
                registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
                registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
                registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
                registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
                registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
                registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
                registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
                registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
                registerFunction( "quarter", new StandardSQLFunction( "quarter", Hibernate.INTEGER ) );
                registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
                registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
                registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
                registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
                registerFunction( "monthname", new StandardSQLFunction( "monthname", 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( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
                registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
                registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
                registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
                registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
                registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
                registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
                registerFunction( "rand", new StandardSQLFunction( "rand", Hibernate.FLOAT ) );

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

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

                // Multi-param dialect functions...
                registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );

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

                getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
View Full Code Here

    // standard sql92 functions (can be overridden by subclasses)
    registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1, ?2, ?3)" ) );
    registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "locate(?1, ?2, ?3)" ) );
    registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "trim(?1 ?2 ?3 ?4)" ) );
    registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.INTEGER ) );
    registerFunction( "bit_length", new StandardSQLFunction( "bit_length", StandardBasicTypes.INTEGER ) );
    registerFunction( "coalesce", new StandardSQLFunction( "coalesce" ) );
    registerFunction( "nullif", new StandardSQLFunction( "nullif" ) );
    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE) );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "cast", new CastFunction() );
    registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(?1 ?2 ?3)") );

    //map second/minute/hour/day/month/year to ANSI extract(), override on subclasses
    registerFunction( "second", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(second from ?1)") );
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.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

    // support this overloaded version.
    getDefaultProperties().setProperty(Environment.USE_GET_GENERATED_KEYS, "false");
    getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);

    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( "last_day", new StandardSQLFunction("last_day", 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) );
  }
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( "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( "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( "age", new StandardSQLFunction("age") );

    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

    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.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( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "second(?1)") );
    registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "minute(?1)") );
    registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "hour(?1)") );
    registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "day(?1)") );
    registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "month(?1)") );
    registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "year(?1)") );

    registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "?1(?3)") );

    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
    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

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.