Example usage for org.springframework.jdbc.support.rowset SqlRowSet getFloat

List of usage examples for org.springframework.jdbc.support.rowset SqlRowSet getFloat

Introduction

In this page you can find the example usage for org.springframework.jdbc.support.rowset SqlRowSet getFloat.

Prototype

float getFloat(String columnLabel) throws InvalidResultSetAccessException;

Source Link

Document

Retrieve the value of the indicated column in the current row as a float.

Usage

From source file:com.hygenics.parser.getDAOTemplate.java

/**
 * Called when needing a count of distincts or other numerical result.
 * Returns a Float so only an integer should be used
 * // w w  w . j  av a  2  s . c o m
 * @param sql
 * @param columns
 * @return
 */
public float queryForFloat(String sql) {
    SqlRowSet rs = this.jdbcTemplateObject.queryForRowSet(sql);

    if (rs.next()) {
        if (rs.getMetaData().getColumnNames().length > 0) {

            return rs.getFloat(1);
        }
    }
    return 0f;

}