Example usage for java.sql Types REAL

List of usage examples for java.sql Types REAL

Introduction

In this page you can find the example usage for java.sql Types REAL.

Prototype

int REAL

To view the source code for java.sql Types REAL.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type REAL.

Usage

From source file:br.bookmark.db.util.ResultSetUtils.java

/**
 * Map JDBC objects to Java equivalents.
 * Used by getBean() and getBeans()./*from w w  w .  j  av a 2  s  . co  m*/
 * <p>
 * Some types not supported.
 * Many not work with all drivers.
 * <p>
 * Makes binary conversions of BIGINT, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER,
 * REAL, SMALLINT, TIME, TIMESTAMP, TINYINT.
 * Makes Sting conversions of CHAR, CLOB, VARCHAR, LONGVARCHAR, BLOB, LONGVARBINARY,
 * VARBINARY.
 * <p>
 * DECIMAL, INTEGER, SMALLINT, TIMESTAMP, CHAR, VARCHAR tested with MySQL and Poolman.
 * Others not guaranteed.
 * @param classeDestino 
 * @throws NoSuchFieldException 
 * @throws SecurityException 
 */
private static void putEntry(Map properties, ResultSetMetaData metaData, ResultSet resultSet, int i,
        Class classeDestino) throws Exception {

    /*
    In a perfect universe, this would be enough
    properties.put(
        metaData.getColumnName(i),
        resultSet.getObject(i));
    But only String, Timestamp, and Integer seem to get through that way.
    */

    String columnName = metaData.getColumnName(i);

    // Testa se  uma FK
    /*Field[] fields = classeDestino.getDeclaredFields();
    for (int j = 0; j < fields.length; j++) {
    if (fields[j].getAnnotation(DBFK.class) != null) {
        properties.put(columnName, resultSet.getString(i));
    }
    }*/
    //System.out.println(i+"-"+metaData.getColumnType(i));
    switch (metaData.getColumnType(i)) {

    // http://java.sun.com/j2se/1.3.0/docs/api/java/sql/Types.html

    case Types.BIGINT:
        properties.put(columnName, new Long(resultSet.getLong(i)));
        break;

    case Types.DATE:
        properties.put(columnName, resultSet.getDate(i));
        break;

    case Types.DECIMAL:
    case Types.DOUBLE:
        properties.put(columnName, new Double(resultSet.getDouble(i)));
        break;

    case Types.FLOAT:
        properties.put(columnName, new Float(resultSet.getFloat(i)));
        break;

    case Types.INTEGER:
        int valor = 0;
        try { // Se o campo esta vazio d erro
            valor = resultSet.getInt(i);
        } catch (SQLException e) {
        }
        properties.put(columnName, new Integer(valor));
        break;

    case Types.REAL:
        properties.put(columnName, new Double(resultSet.getString(i)));
        break;

    case Types.SMALLINT:
        properties.put(columnName, new Short(resultSet.getShort(i)));
        break;

    case Types.TIME:
        properties.put(columnName, resultSet.getTime(i));
        break;

    case Types.TIMESTAMP:
        properties.put(columnName, resultSet.getTimestamp(i));
        break;

    // :FIXME: Throws java.lang.ClassCastException: java.lang.Integer
    // :FIXME: with Poolman and MySQL unless use getString.
    case Types.TINYINT:
        properties.put(columnName, new Byte(resultSet.getString(i)));
        break;

    case Types.CHAR:
    case Types.CLOB:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
        // :FIXME: Handle binaries differently?
    case Types.BLOB:
    case Types.LONGVARBINARY:
    case Types.VARBINARY:
        properties.put(columnName, resultSet.getString(i));
        break;

    /*
        :FIXME: Add handlers for
        ARRAY
        BINARY
        BIT
        DISTINCT
        JAVA_OBJECT
        NULL
        NUMERIC
        OTHER
        REF
        STRUCT
    */

    // Otherwise, pass as *String property to be converted
    default:
        properties.put(columnName + "String", resultSet.getString(i));
        break;
    } // end switch

}

From source file:com.squid.core.domain.operators.ExtendedType.java

/**
 * compute a type "order" that can be used to compare types and promote types.
 * The order is a couple (x,y), where x represent a family type (string,date,numbers) and y an order in that family
 * A type should be promoted to the higher order.
 * @return/*from  ww w  .j  a v a2  s.  c  o  m*/
 */
public int[] computeTypeOrder() {
    switch (getDataType()) {
    case Types.BIT:
        return new int[] { NUMBER_ORDER, 0 };
    case Types.BOOLEAN:
        return new int[] { NUMBER_ORDER, 1 };
    case Types.TINYINT:
        return new int[] { NUMBER_ORDER, 2 };
    case Types.SMALLINT:
        return new int[] { NUMBER_ORDER, 3 };
    case Types.INTEGER:
        return new int[] { NUMBER_ORDER, 4 };
    case Types.BIGINT:
        return new int[] { NUMBER_ORDER, 5 };
    ///////////////////////////
    case Types.REAL:
        return new int[] { NUMBER_ORDER, 6 };
    case Types.DOUBLE:
    case Types.FLOAT:
        return new int[] { NUMBER_ORDER, 7 };
    case Types.DECIMAL:
        return new int[] { NUMBER_ORDER, 8 };
    case Types.NUMERIC:
        return new int[] { NUMBER_ORDER, 9 };
    //////////////////////////
    case Types.CHAR:
        return new int[] { STRING_ORDER, 0 };
    case Types.VARCHAR:
        return new int[] { STRING_ORDER, 1 };
    case Types.LONGVARCHAR:
        return new int[] { STRING_ORDER, 2 };
    case Types.CLOB:
        return new int[] { STRING_ORDER, 3 };
    ///////////////////////////
    case Types.TIME:
        return new int[] { DATE_ORDER, 1 };
    case Types.DATE:
        return new int[] { DATE_ORDER, 2 };
    case Types.TIMESTAMP:
        return new int[] { DATE_ORDER, 3 };
    case CustomTypes.INTERVAL:
        return new int[] { DATE_ORDER, 4 };
    ///////////////////////////
    default:
        return new int[] { UNKNOWN_ORDER, 0 };
    }
}

From source file:org.apache.hadoop.sqoop.manager.SqlManager.java

public String toJavaType(int sqlType) {
    // mappings from http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html
    if (sqlType == Types.INTEGER) {
        return "Integer";
    } else if (sqlType == Types.VARCHAR) {
        return "String";
    } else if (sqlType == Types.CHAR) {
        return "String";
    } else if (sqlType == Types.LONGVARCHAR) {
        return "String";
    } else if (sqlType == Types.NUMERIC) {
        return "java.math.BigDecimal";
    } else if (sqlType == Types.DECIMAL) {
        return "java.math.BigDecimal";
    } else if (sqlType == Types.BIT) {
        return "Boolean";
    } else if (sqlType == Types.BOOLEAN) {
        return "Boolean";
    } else if (sqlType == Types.TINYINT) {
        return "Integer";
    } else if (sqlType == Types.SMALLINT) {
        return "Integer";
    } else if (sqlType == Types.BIGINT) {
        return "Long";
    } else if (sqlType == Types.REAL) {
        return "Float";
    } else if (sqlType == Types.FLOAT) {
        return "Double";
    } else if (sqlType == Types.DOUBLE) {
        return "Double";
    } else if (sqlType == Types.DATE) {
        return "java.sql.Date";
    } else if (sqlType == Types.TIME) {
        return "java.sql.Time";
    } else if (sqlType == Types.TIMESTAMP) {
        return "java.sql.Timestamp";
    } else {//from  w  w w  .j  a v a 2s .  c  o m
        // TODO(aaron): Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB, BLOB, ARRAY,
        // STRUCT, REF, JAVA_OBJECT.
        return null;
    }
}

From source file:org.apache.ddlutils.io.RoundtripTestBase.java

/**
 * Returns the original model adjusted for type changes because of the native type mappings
 * which when read back from the database will map to different types.
 * /* w  w w  .  java 2 s. co  m*/
 * @return The adjusted model
 */
protected Database getAdjustedModel() {
    try {
        Database model = (Database) getModel().clone();

        for (int tableIdx = 0; tableIdx < model.getTableCount(); tableIdx++) {
            Table table = model.getTable(tableIdx);

            for (int columnIdx = 0; columnIdx < table.getColumnCount(); columnIdx++) {
                Column column = table.getColumn(columnIdx);
                int origType = column.getTypeCode();
                int targetType = getPlatformInfo().getTargetJdbcType(origType);

                // we adjust the column types if the native type would back-map to a
                // different jdbc type
                if (targetType != origType) {
                    column.setTypeCode(targetType);
                    // we should also adapt the default value
                    if (column.getDefaultValue() != null) {
                        DefaultValueHelper helper = getPlatform().getSqlBuilder().getDefaultValueHelper();

                        column.setDefaultValue(helper.convert(column.getDefaultValue(), origType, targetType));
                    }
                }
                // we also promote the default size if the column has no size
                // spec of its own
                if ((column.getSize() == null) && getPlatformInfo().hasSize(targetType)) {
                    Integer defaultSize = getPlatformInfo().getDefaultSize(targetType);

                    if (defaultSize != null) {
                        column.setSize(defaultSize.toString());
                    }
                }
                // finally the platform might return a synthetic default value if the column
                // is a primary key column
                if (getPlatformInfo().isSyntheticDefaultValueForRequiredReturned()
                        && (column.getDefaultValue() == null) && column.isRequired()
                        && !column.isAutoIncrement()) {
                    switch (column.getTypeCode()) {
                    case Types.TINYINT:
                    case Types.SMALLINT:
                    case Types.INTEGER:
                    case Types.BIGINT:
                        column.setDefaultValue("0");
                        break;
                    case Types.REAL:
                    case Types.FLOAT:
                    case Types.DOUBLE:
                        column.setDefaultValue("0.0");
                        break;
                    case Types.BIT:
                        column.setDefaultValue("false");
                        break;
                    default:
                        column.setDefaultValue("");
                        break;
                    }
                }
            }
            // we also add the default names to foreign keys that are initially unnamed
            for (int fkIdx = 0; fkIdx < table.getForeignKeyCount(); fkIdx++) {
                ForeignKey fk = table.getForeignKey(fkIdx);

                if (fk.getName() == null) {
                    fk.setName(getPlatform().getSqlBuilder().getForeignKeyName(table, fk));
                }
            }
        }
        return model;
    } catch (CloneNotSupportedException ex) {
        throw new RuntimeException(ex);
    }
}

From source file:org.waarp.common.database.data.AbstractDbData.java

/**
 * Set Value into PreparedStatement/*from  w ww .jav a  2  s  . c o  m*/
 * 
 * @param ps
 * @param value
 * @param rank
 *            >= 1
 * @throws WaarpDatabaseSqlException
 */
static public void setTrueValue(PreparedStatement ps, DbValue value, int rank)
        throws WaarpDatabaseSqlException {
    try {
        switch (value.type) {
        case Types.VARCHAR:
            if (value.value == null) {
                ps.setNull(rank, Types.VARCHAR);
                break;
            }
            ps.setString(rank, (String) value.value);
            break;
        case Types.LONGVARCHAR:
            if (value.value == null) {
                ps.setNull(rank, Types.LONGVARCHAR);
                break;
            }
            ps.setString(rank, (String) value.value);
            break;
        case Types.BIT:
            if (value.value == null) {
                ps.setNull(rank, Types.BIT);
                break;
            }
            ps.setBoolean(rank, (Boolean) value.value);
            break;
        case Types.TINYINT:
            if (value.value == null) {
                ps.setNull(rank, Types.TINYINT);
                break;
            }
            ps.setByte(rank, (Byte) value.value);
            break;
        case Types.SMALLINT:
            if (value.value == null) {
                ps.setNull(rank, Types.SMALLINT);
                break;
            }
            ps.setShort(rank, (Short) value.value);
            break;
        case Types.INTEGER:
            if (value.value == null) {
                ps.setNull(rank, Types.INTEGER);
                break;
            }
            ps.setInt(rank, (Integer) value.value);
            break;
        case Types.BIGINT:
            if (value.value == null) {
                ps.setNull(rank, Types.BIGINT);
                break;
            }
            ps.setLong(rank, (Long) value.value);
            break;
        case Types.REAL:
            if (value.value == null) {
                ps.setNull(rank, Types.REAL);
                break;
            }
            ps.setFloat(rank, (Float) value.value);
            break;
        case Types.DOUBLE:
            if (value.value == null) {
                ps.setNull(rank, Types.DOUBLE);
                break;
            }
            ps.setDouble(rank, (Double) value.value);
            break;
        case Types.VARBINARY:
            if (value.value == null) {
                ps.setNull(rank, Types.VARBINARY);
                break;
            }
            ps.setBytes(rank, (byte[]) value.value);
            break;
        case Types.DATE:
            if (value.value == null) {
                ps.setNull(rank, Types.DATE);
                break;
            }
            ps.setDate(rank, (Date) value.value);
            break;
        case Types.TIMESTAMP:
            if (value.value == null) {
                ps.setNull(rank, Types.TIMESTAMP);
                break;
            }
            ps.setTimestamp(rank, (Timestamp) value.value);
            break;
        case Types.CLOB:
            if (value.value == null) {
                ps.setNull(rank, Types.CLOB);
                break;
            }
            ps.setClob(rank, (Reader) value.value);
            break;
        case Types.BLOB:
            if (value.value == null) {
                ps.setNull(rank, Types.BLOB);
                break;
            }
            ps.setBlob(rank, (InputStream) value.value);
            break;
        default:
            throw new WaarpDatabaseSqlException("Type not supported: " + value.type + " at " + rank);
        }
    } catch (ClassCastException e) {
        throw new WaarpDatabaseSqlException("Setting values casting error: " + value.type + " at " + rank, e);
    } catch (SQLException e) {
        DbSession.error(e);
        throw new WaarpDatabaseSqlException("Setting values in error: " + value.type + " at " + rank, e);
    }
}

From source file:org.apache.ddlutils.model.Column.java

/**
 * Tries to parse the default value of the column and returns it as an object of the
 * corresponding java type. If the value could not be parsed, then the original
 * definition is returned./*  www .  ja  v  a  2s  .co  m*/
 * 
 * @return The parsed default value
 */
public Object getParsedDefaultValue() {
    if ((_defaultValue != null) && (_defaultValue.length() > 0)) {
        try {
            switch (_typeCode) {
            case Types.TINYINT:
            case Types.SMALLINT:
                return new Short(_defaultValue);
            case Types.INTEGER:
                return new Integer(_defaultValue);
            case Types.BIGINT:
                return new Long(_defaultValue);
            case Types.DECIMAL:
            case Types.NUMERIC:
                return new BigDecimal(_defaultValue);
            case Types.REAL:
                return new Float(_defaultValue);
            case Types.DOUBLE:
            case Types.FLOAT:
                return new Double(_defaultValue);
            case Types.DATE:
                return Date.valueOf(_defaultValue);
            case Types.TIME:
                return Time.valueOf(_defaultValue);
            case Types.TIMESTAMP:
                return Timestamp.valueOf(_defaultValue);
            case Types.BIT:
            case Types.BOOLEAN:
                return ConvertUtils.convert(_defaultValue, Boolean.class);
            }
        } catch (NumberFormatException ex) {
            return null;
        } catch (IllegalArgumentException ex) {
            return null;
        }
    }
    return _defaultValue;
}

From source file:org.castor.jdo.engine.SQLTypeInfos.java

/**
 * Set given value on given PreparedStatement at given index with given SQL type.
 * //w w w  .jav a2  s  . co m
 * @param stmt The PreparedStatement to set value on.
 * @param index The index of the value in the PreparedStatement.
 * @param value The value to set.
 * @param sqlType The SQL type of the value.
 */
public static void setValue(final PreparedStatement stmt, final int index, final Object value,
        final int sqlType) {
    try {
        if (value == null) {
            stmt.setNull(index, sqlType);
        } else {
            // Special processing for BLOB and CLOB types, because they are mapped
            // by Castor to java.io.InputStream and java.io.Reader, respectively,
            // while JDBC driver expects java.sql.Blob and java.sql.Clob.
            switch (sqlType) {
            case Types.FLOAT:
            case Types.DOUBLE:
                stmt.setDouble(index, ((Double) value).doubleValue());
                break;
            case Types.REAL:
                stmt.setFloat(index, ((Float) value).floatValue());
                break;
            case Types.TIME:
                final Time time = value instanceof java.util.Date ? new Time(((java.util.Date) value).getTime())
                        : null;
                stmt.setTime(index, time != null ? time : (Time) value, getCalendar());
                break;
            case Types.DATE:
                final Date date = value instanceof java.util.Date ? new Date(((java.util.Date) value).getTime())
                        : null;
                stmt.setDate(index, date != null ? date : (Date) value);
                break;
            case Types.TIMESTAMP:
                final Timestamp timestamp = value instanceof java.util.Date
                        ? new Timestamp(((java.util.Date) value).getTime())
                        : null;
                stmt.setTimestamp(index, timestamp != null ? timestamp : (Timestamp) value, getCalendar());
                break;
            case Types.BLOB:
                try {
                    InputStream stream;
                    if (value instanceof byte[]) {
                        stream = new ByteArrayInputStream((byte[]) value);
                    } else {
                        stream = (InputStream) value;
                    }
                    stmt.setBinaryStream(index, stream, stream.available());
                } catch (IOException ex) {
                    throw new SQLException(ex.toString());
                }
                break;
            case Types.CLOB:
                if (value instanceof String) {
                    stmt.setCharacterStream(index, new StringReader((String) value),
                            Math.min(((String) value).length(), Integer.MAX_VALUE));
                } else {
                    stmt.setCharacterStream(index, ((Clob) value).getCharacterStream(),
                            (int) Math.min(((Clob) value).length(), Integer.MAX_VALUE));
                }
                break;
            default:
                stmt.setObject(index, value, sqlType);
                break;
            }
        }
    } catch (SQLException ex) {
        LOG.error("Unexpected SQL exception: ", ex);
    }
}

From source file:org.jumpmind.symmetric.db.derby.DerbyFunctions.java

public static String getPrimaryKeyWhereString(String[] pkColumnNames, ResultSet rs) throws SQLException {
    final String AND = " and ";
    ResultSetMetaData metaData = rs.getMetaData();
    StringBuilder b = new StringBuilder();
    for (int i = 0; i < pkColumnNames.length; i++) {
        String columnName = pkColumnNames[i];
        int index = findColumnIndex(metaData, columnName);
        int type = metaData.getColumnType(index);
        if (type != Types.BINARY && type != Types.BLOB && type != Types.LONGVARBINARY
                && type != Types.VARBINARY) {
            b.append("\"").append(columnName).append("\"=");
            switch (type) {
            case Types.BIT:
            case Types.TINYINT:
            case Types.SMALLINT:
            case Types.INTEGER:
            case Types.BIGINT:
            case Types.FLOAT:
            case Types.REAL:
            case Types.DOUBLE:
            case Types.NUMERIC:
            case Types.DECIMAL:
            case Types.BOOLEAN:
                b.append(rs.getObject(index));
                break;
            case Types.CHAR:
            case Types.VARCHAR:
            case Types.LONGVARCHAR:
                b.append("\"").append(rs.getString(index)).append("\"");
                break;
            case Types.DATE:
            case Types.TIMESTAMP:
                b.append("{ts '");
                b.append(rs.getString(index));
                b.append("'}");
                break;
            }// w  w  w  .  jav  a2s. c o m
            b.append(AND);
        }
    }
    b.replace(b.length() - AND.length(), b.length(), "");
    return b.toString();
}

From source file:com.nextep.designer.sqlclient.ui.connectors.SQLResultConnector.java

private void initializeTable(ISQLQuery query, long executionTime, INextepMetadata md) {
    colMaxWidth = new int[md.getColumnCount() + 1];
    // Checking columns to display
    int displayedColumns = query.getDisplayedColumnsCount();
    if (displayedColumns <= 0) {
        displayedColumns = md.getColumnCount();
    }/*from w  ww  .  j  a v  a  2  s.co  m*/
    for (int i = 1; i <= displayedColumns; i++) {
        final String colName = md.getColumnName(i);
        // final int colPrecision = md.getPrecision(index);
        final int colType = md.getColumnType(i);

        final int colIndex = i - 1;
        if (!sqlView.isDisposed()) {
            TableColumn c = new TableColumn(sqlView, SWT.NONE);
            c.setText(colName);
            c.setWidth(colName.length() * 8);
            c.addListener(SWT.Selection, comparator);
            colMaxWidth[colIndex] = c.getWidth();
            SQLResultLabelProvider lblProvider = new SQLResultLabelProvider(this, colIndex);
            final TableViewerColumn viewerCol = new TableViewerColumn(sqlViewer, c);
            viewerCol.setLabelProvider(lblProvider);
            // Registering column comparator
            switch (colType) {
            case Types.BIGINT:
            case Types.BIT:
            case Types.DECIMAL:
            case Types.DOUBLE:
            case Types.FLOAT:
            case Types.INTEGER:
            case Types.NUMERIC:
            case Types.REAL:
            case Types.SMALLINT:
            case Types.TINYINT:
                c.setData(SQLResultViewerComparator.KEY_COMPARATOR, new NumberComparator());
                // Setting our deserializer which can produce number from string
                c.setData(KEY_DESERIALIZER, NUMBER_DESERIALIZER);
                break;
            case Types.DATE:
            case Types.TIME:
            case Types.TIMESTAMP:
                // Defines validation so that user will be notified about problems
                c.setData(KEY_CELL_VALIDATOR, DATE_VALIDATOR);
                // Setting our deserializer which can produce date from string
                c.setData(KEY_DESERIALIZER, DATE_DESERIALIZER);
                c.setData(SQLResultViewerComparator.KEY_COMPARATOR, new DateComparator());
                break;
            default:
                c.setData(KEY_DESERIALIZER, STRING_DESERIALIZER);
                c.setData(SQLResultViewerComparator.KEY_COMPARATOR, new StringComparator());
            }
        }
    }
    registerCellEditors();
    setStatusLabel(MessageFormat.format(SQLClientMessages.getString("sql.executionTime"), executionTime),
            false);
    sqlViewer.setInput(query.getResult());
}

From source file:org.hibernate.dialect.Dialect.java

protected Dialect() {
    log.info("Using dialect: " + this);
    sqlFunctions.putAll(STANDARD_AGGREGATE_FUNCTIONS);

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

    //map second/minute/hour/day/month/year to ANSI extract(), override on subclasses
    registerFunction("second", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(second from ?1)"));
    registerFunction("minute", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(minute from ?1)"));
    registerFunction("hour", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(hour from ?1)"));
    registerFunction("day", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(day from ?1)"));
    registerFunction("month", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(month from ?1)"));
    registerFunction("year", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(year from ?1)"));

    registerFunction("str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as char)"));

    // register hibernate types for default use in scalar sqlquery type auto detection
    registerHibernateType(Types.BIGINT, Hibernate.BIG_INTEGER.getName());
    registerHibernateType(Types.BINARY, Hibernate.BINARY.getName());
    registerHibernateType(Types.BIT, Hibernate.BOOLEAN.getName());
    registerHibernateType(Types.CHAR, Hibernate.CHARACTER.getName());
    registerHibernateType(Types.DATE, Hibernate.DATE.getName());
    registerHibernateType(Types.DOUBLE, Hibernate.DOUBLE.getName());
    registerHibernateType(Types.FLOAT, Hibernate.FLOAT.getName());
    registerHibernateType(Types.INTEGER, Hibernate.INTEGER.getName());
    registerHibernateType(Types.SMALLINT, Hibernate.SHORT.getName());
    registerHibernateType(Types.TINYINT, Hibernate.BYTE.getName());
    registerHibernateType(Types.TIME, Hibernate.TIME.getName());
    registerHibernateType(Types.TIMESTAMP, Hibernate.TIMESTAMP.getName());
    registerHibernateType(Types.VARCHAR, Hibernate.STRING.getName());
    registerHibernateType(Types.VARBINARY, Hibernate.BINARY.getName());
    registerHibernateType(Types.NUMERIC, Hibernate.BIG_DECIMAL.getName());
    registerHibernateType(Types.DECIMAL, Hibernate.BIG_DECIMAL.getName());
    registerHibernateType(Types.BLOB, Hibernate.BLOB.getName());
    registerHibernateType(Types.CLOB, Hibernate.CLOB.getName());
    registerHibernateType(Types.REAL, Hibernate.FLOAT.getName());
}