Example usage for org.hibernate ScrollableResults getType

List of usage examples for org.hibernate ScrollableResults getType

Introduction

In this page you can find the example usage for org.hibernate ScrollableResults getType.

Prototype

Type getType(int i);

Source Link

Document

Get the type of the ith column of results.

Usage

From source file:org.compass.gps.device.hibernate.scrollable.Hibernate3Dialect.java

License:Apache License

protected Long getLong(ScrollableResults rs, String[] returnAliases, ColumnMapping columnMapping) {
    int index = -1;
    if (columnMapping.isUsingColumnIndex()) {
        index = columnMapping.getColumnIndex();
    } else {//from   w  ww.  j  av a2 s .  co m
        index = getIndex(returnAliases, columnMapping);
    }
    Type type = rs.getType(index);
    Long result;
    if (type instanceof IntegerType) {
        result = new Long(rs.getInteger(index).longValue());
    } else if (type instanceof DateType) {
        result = new Long(rs.getDate(index).getTime());
    } else {
        result = rs.getLong(index);
    }
    return result;
}

From source file:org.compass.gps.device.hibernate.scrollable.Hibernate3Dialect.java

License:Apache License

public String getStringValue(ScrollableResults rs, String[] returnAliases, ColumnMapping mapping) {
    int index = -1;
    if (mapping.isUsingColumnIndex()) {
        index = mapping.getColumnIndex();
    } else {/* w ww .  jav a 2  s .c om*/
        index = getIndex(returnAliases, mapping);
    }
    Type type = rs.getType(index);
    String result;
    if (type instanceof StringType) {
        result = rs.getString(index);
    } else {
        result = rs.get(index).toString();
    }
    return result;
}

From source file:org.compass.gps.device.hibernate.scrollable.Hibernate3Dialect.java

License:Apache License

public String getStringValue(ScrollableResults rs, int columnIndex) {
    Type type = rs.getType(columnIndex);
    String result;/*from w w  w. j  a v a2s.co  m*/
    if (type instanceof StringType) {
        result = rs.getString(columnIndex);
    } else {
        result = rs.get(columnIndex).toString();
    }
    return result;
}