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

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

Introduction

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

Prototype

BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException;

Source Link

Document

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

Usage

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

/**
 * Called when needing a count of distincts or other numerical result.
 * Returns an Big Integer so only an integer should be used
 * /*from   w  ww  . j  a  va  2s  . co  m*/
 * @param sql
 * @param columns
 * @return
 */
public BigDecimal queryForBigInt(String sql) {
    SqlRowSet rs = this.jdbcTemplateObject.queryForRowSet(sql);

    if (rs.next()) {
        if (rs.getMetaData().getColumnNames().length > 0) {
            return rs.getBigDecimal(1);
        }
    }
    return new BigDecimal(0);
}