Example usage for org.hibernate.type StandardBasicTypes DOUBLE

List of usage examples for org.hibernate.type StandardBasicTypes DOUBLE

Introduction

In this page you can find the example usage for org.hibernate.type StandardBasicTypes DOUBLE.

Prototype

DoubleType DOUBLE

To view the source code for org.hibernate.type StandardBasicTypes DOUBLE.

Click Source Link

Document

The standard Hibernate type for mapping Double to JDBC java.sql.Types#DOUBLE DOUBLE .

Usage

From source file:com.processpuzzle.fundamental_types.possiblevalue.domain.PossibleValueDefinitionTypeMapping.java

License:Open Source License

public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
        throws HibernateException, SQLException {
    if (value != null) {
        PossibleValueDefinition valueDefinition = (PossibleValueDefinition) value;
        StandardBasicTypes.STRING.nullSafeSet(statement, valueDefinition.getClass().getName(), index, session);
        if (valueDefinition instanceof QuantityRange) {

            QuantityRange range = (QuantityRange) valueDefinition;
            if (range.getMinValue() != null && range.getMaxValue() != null) {
                StandardBasicTypes.DOUBLE.nullSafeSet(statement, range.getMinValue().getAmount(), index + 1,
                        session);/*from  w ww  .  j av a  2  s . com*/
                StandardBasicTypes.STRING.nullSafeSet(statement, range.getMinValue().getUnit().getSymbol(),
                        index + 2, session);
                StandardBasicTypes.DOUBLE.nullSafeSet(statement, range.getMaxValue().getAmount(), index + 3,
                        session);
                StandardBasicTypes.STRING.nullSafeSet(statement, range.getMaxValue().getUnit().getSymbol(),
                        index + 4, session);
            } else {
                statement.setNull(index + 1, Types.DOUBLE);
                statement.setNull(index + 2, Types.VARCHAR);
                statement.setNull(index + 3, Types.DOUBLE);
                statement.setNull(index + 4, Types.VARCHAR);
            }
            statement.setNull(index + 5, Types.VARCHAR);

        } else if (valueDefinition instanceof StringParseable) {
            statement.setNull(index + 1, Types.DOUBLE);
            statement.setNull(index + 2, Types.VARCHAR);
            statement.setNull(index + 3, Types.DOUBLE);
            statement.setNull(index + 4, Types.VARCHAR);
            StandardBasicTypes.STRING.nullSafeSet(statement, ((StringParseable) valueDefinition).stringValue(),
                    index + 5, session);

        }
    } else {
        statement.setNull(index, Types.VARCHAR);
        statement.setNull(index + 1, Types.DOUBLE);
        statement.setNull(index + 2, Types.VARCHAR);
        statement.setNull(index + 3, Types.DOUBLE);
        statement.setNull(index + 4, Types.VARCHAR);
        statement.setNull(index + 5, Types.VARCHAR);
    }
}

From source file:com.processpuzzle.fundamental_types.possiblevalue.domain.PossibleValueDefinitionTypeMapping.java

License:Open Source License

public Type[] getPropertyTypes() {
    return new Type[] { StandardBasicTypes.STRING, StandardBasicTypes.DOUBLE, StandardBasicTypes.STRING,
            StandardBasicTypes.DOUBLE, StandardBasicTypes.STRING, StandardBasicTypes.STRING };
}

From source file:com.processpuzzle.persistence.typemapping.domain.MoneyTypeMapping.java

License:Open Source License

public Type[] getPropertyTypes() {
    return new Type[] { StandardBasicTypes.DOUBLE, StandardBasicTypes.STRING };
}

From source file:com.processpuzzle.persistence.typemapping.domain.MoneyTypeMapping.java

License:Open Source License

public Object nullSafeGet(ResultSet resultSet, String[] names, SessionImplementor session, Object owner)
        throws HibernateException, SQLException {
    Double amount = (Double) StandardBasicTypes.DOUBLE.nullSafeGet(resultSet, names[0], session);
    String currencySymbol = (String) StandardBasicTypes.STRING.nullSafeGet(resultSet, names[1], session);
    if (amount == null && currencySymbol == null)
        return null;
    else {/*from   w  w w  .j  a  v a 2s.c o m*/
        ProcessPuzzleContext applicationContext = UserRequestManager.getInstance().getApplicationContext();
        MeasurementContext measurementContext = applicationContext.getMeasurementContext();
        return new Money(amount, measurementContext.findUnitBySymbol(currencySymbol));
    }
}

From source file:com.processpuzzle.persistence.typemapping.domain.MoneyTypeMapping.java

License:Open Source License

public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
        throws HibernateException, SQLException {
    Money money = (Money) value;/*from w ww.  ja  va2 s.c  o  m*/
    if (money != null && money.getAmount() != null && money.getUnit() != null) {
        StandardBasicTypes.DOUBLE.nullSafeSet(statement, money.getAmount(), index, session);
        //         StandardBasicTypes.CURRENCY.nullSafeSet(statement, money.getUnit().getSymbol(), index+1);
        String currenySymbol = money.getUnit().getSymbol();
        ProcessPuzzleContext applicationContext = UserRequestManager.getInstance().getApplicationContext();
        MeasurementContext measurementContext = applicationContext.getMeasurementContext();
        if (measurementContext.findUnitBySymbol(currenySymbol) == null) {
            throw new MoneyTypeMappingException("Unit must have currency symbol in MonyTypeMapping");
        }
        StandardBasicTypes.STRING.nullSafeSet(statement, currenySymbol, index + 1, session);
    } else {
        statement.setNull(index, Types.DOUBLE);
        statement.setNull(index + 1, Types.VARCHAR);
    }
}

From source file:com.processpuzzle.persistence.typemapping.domain.QuantityTypeMapping.java

License:Open Source License

public Object nullSafeGet(ResultSet resultSet, String[] names, SessionImplementor session, Object owner)
        throws HibernateException, SQLException {
    Double amount = (Double) StandardBasicTypes.DOUBLE.nullSafeGet(resultSet, names[0], session);
    String unitSymbol = (String) StandardBasicTypes.STRING.nullSafeGet(resultSet, names[1], session);
    if (amount == null && unitSymbol == null)
        return null;
    else {//from ww  w .jav a 2 s  .co  m
        ProcessPuzzleContext applicationContext = UserRequestManager.getInstance().getApplicationContext();
        MeasurementContext measurementContext = applicationContext.getMeasurementContext();
        return new Quantity(amount, measurementContext.findUnitBySymbol(unitSymbol));
    }
}

From source file:com.processpuzzle.persistence.typemapping.domain.QuantityTypeMapping.java

License:Open Source License

public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
        throws HibernateException, SQLException {
    Quantity quantity = (Quantity) value;

    if (quantity != null && quantity.getAmount() != null && quantity.getUnit() != null) {
        StandardBasicTypes.DOUBLE.nullSafeSet(statement, quantity.getAmount(), index, session);
        StandardBasicTypes.STRING.nullSafeSet(statement, quantity.getUnit().getSymbol(), index + 1, session);
    } else {//from   ww  w .ja v  a 2s  . c o  m
        statement.setNull(index, Types.DOUBLE);
        statement.setNull(index + 1, Types.VARCHAR);
    }
}

From source file:com.syndiceo.MySQLDialect.java

License:Open Source License

public MySQLDialect() {
    super();/*from   w w  w .  ja  v a2  s  .  co m*/
    registerColumnType(Types.BIT, "bit");
    registerColumnType(Types.BIGINT, "int8");
    registerColumnType(Types.SMALLINT, "smallint");
    registerColumnType(Types.TINYINT, "tinyint");
    registerColumnType(Types.INTEGER, "integer");
    registerColumnType(Types.CHAR, "char(1)");
    registerColumnType(Types.FLOAT, "float");
    registerColumnType(Types.DOUBLE, "double precision");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "datetime");
    registerColumnType(Types.VARBINARY, "longblob");
    registerColumnType(Types.VARBINARY, 16777215, "mediumblob");
    registerColumnType(Types.VARBINARY, 65535, "blob");
    registerColumnType(Types.VARBINARY, 255, "tinyblob");
    registerColumnType(Types.BINARY, "binary($l)");
    registerColumnType(Types.LONGVARBINARY, "longblob");
    registerColumnType(Types.LONGVARBINARY, 16777215, "mediumblob");
    registerColumnType(Types.NUMERIC, "decimal($p,$s)");
    registerColumnType(Types.BLOB, "longblob");
    //      registerColumnType( Types.BLOB, 16777215, "mediumblob" );
    //      registerColumnType( Types.BLOB, 65535, "blob" );
    registerColumnType(Types.CLOB, "longtext");
    //      registerColumnType( Types.CLOB, 16777215, "mediumtext" );
    //      registerColumnType( Types.CLOB, 65535, "text" );
    registerVarcharTypes();

    registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER));
    registerFunction("bin", new StandardSQLFunction("bin", StandardBasicTypes.STRING));
    registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.LONG));
    registerFunction("character_length", new StandardSQLFunction("character_length", StandardBasicTypes.LONG));
    registerFunction("lcase", new StandardSQLFunction("lcase"));
    registerFunction("lower", new StandardSQLFunction("lower"));
    registerFunction("ltrim", new StandardSQLFunction("ltrim"));
    registerFunction("ord", new StandardSQLFunction("ord", StandardBasicTypes.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", StandardBasicTypes.STRING));
    registerFunction("ucase", new StandardSQLFunction("ucase"));
    registerFunction("upper", new StandardSQLFunction("upper"));
    registerFunction("unhex", new StandardSQLFunction("unhex", StandardBasicTypes.STRING));

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

    registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE));
    registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE));
    registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE));
    registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE));
    registerFunction("cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE));
    registerFunction("crc32", new StandardSQLFunction("crc32", StandardBasicTypes.LONG));
    registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE));
    registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE));
    registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE));
    registerFunction("log2", new StandardSQLFunction("log2", StandardBasicTypes.DOUBLE));
    registerFunction("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE));
    registerFunction("pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE));
    registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE));
    registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE));
    registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE));
    registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE));

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

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

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

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

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

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

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

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

    getDefaultProperties().setProperty(Environment.MAX_FETCH_DEPTH, "2");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
}

From source file:com.syndiceo.PostgreSQLDialect.java

License:Open Source License

public PostgreSQLDialect() {
    super();/*from   w w w .j a  va 2s  .c  o m*/
    registerColumnType(Types.BIT, "bool");
    registerColumnType(Types.BIGINT, "int8");
    registerColumnType(Types.SMALLINT, "int2");
    registerColumnType(Types.TINYINT, "int2");
    registerColumnType(Types.INTEGER, "int4");
    registerColumnType(Types.CHAR, "char(1)");
    registerColumnType(Types.VARCHAR, "varchar($l)");
    registerColumnType(Types.FLOAT, "float4");
    registerColumnType(Types.DOUBLE, "float8");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "timestamp");
    registerColumnType(Types.VARBINARY, "bytea");
    registerColumnType(Types.BINARY, "bytea");
    registerColumnType(Types.LONGVARCHAR, "text");
    registerColumnType(Types.LONGVARBINARY, "bytea");
    registerColumnType(Types.CLOB, "text");
    registerColumnType(Types.BLOB, "oid");
    registerColumnType(Types.NUMERIC, "numeric($p, $s)");
    registerColumnType(Types.OTHER, "uuid");

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

    registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE));
    registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE));
    registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE));
    registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE));
    registerFunction("cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE));
    registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE));
    registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE));
    registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE));
    registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE));
    registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE));
    registerFunction("cbrt", new StandardSQLFunction("cbrt", StandardBasicTypes.DOUBLE));
    registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE));
    registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE));
    registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE));

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

    registerFunction("random", new NoArgSQLFunction("random", StandardBasicTypes.DOUBLE));

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

    registerFunction("chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER));
    registerFunction("lower", new StandardSQLFunction("lower"));
    registerFunction("upper", new StandardSQLFunction("upper"));
    registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
    registerFunction("initcap", new StandardSQLFunction("initcap"));
    registerFunction("to_ascii", new StandardSQLFunction("to_ascii"));
    registerFunction("quote_ident", new StandardSQLFunction("quote_ident", StandardBasicTypes.STRING));
    registerFunction("quote_literal", new StandardSQLFunction("quote_literal", StandardBasicTypes.STRING));
    registerFunction("md5", new StandardSQLFunction("md5"));
    registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER));
    registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.LONG));
    registerFunction("bit_length", new StandardSQLFunction("bit_length", StandardBasicTypes.LONG));
    registerFunction("octet_length", new StandardSQLFunction("octet_length", StandardBasicTypes.LONG));

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

    registerFunction("current_user", new NoArgSQLFunction("current_user", StandardBasicTypes.STRING, false));
    registerFunction("session_user", new NoArgSQLFunction("session_user", StandardBasicTypes.STRING, false));
    registerFunction("user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false));
    registerFunction("current_database",
            new NoArgSQLFunction("current_database", StandardBasicTypes.STRING, true));
    registerFunction("current_schema", new NoArgSQLFunction("current_schema", StandardBasicTypes.STRING, true));

    registerFunction("to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING));
    registerFunction("to_date", new StandardSQLFunction("to_date", StandardBasicTypes.DATE));
    registerFunction("to_timestamp", new StandardSQLFunction("to_timestamp", StandardBasicTypes.TIMESTAMP));
    registerFunction("to_number", new StandardSQLFunction("to_number", StandardBasicTypes.BIG_DECIMAL));

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

    registerFunction("locate", new PositionSubstringFunction());

    registerFunction("str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as varchar)"));

    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
    getDefaultProperties().setProperty(Environment.NON_CONTEXTUAL_LOB_CREATION, "true");
}

From source file:com.vmware.sqlfire.hibernate.SQLFireDialect.java

License:Open Source License

public SQLFireDialect() {
    super();//from ww  w  . j  av  a 2  s. c o  m
    LOG.info("SQLFireDialect for Hibernate 4 initialized.");

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