Example usage for org.springframework.dao EmptyResultDataAccessException getActualSize

List of usage examples for org.springframework.dao EmptyResultDataAccessException getActualSize

Introduction

In this page you can find the example usage for org.springframework.dao EmptyResultDataAccessException getActualSize.

Prototype

public int getActualSize() 

Source Link

Document

Return the actual result size (or -1 if unknown).

Usage

From source file:com.butler.service.UserDao.java

public boolean doesNumberExist(long number) {
    try {//from w  w  w. j a v a2 s. c  om
        this.getSimpleJdbcTemplate().queryForLong("select id from user where number=?", number);
    } catch (EmptyResultDataAccessException exception) {
        return false;
    } catch (IncorrectResultSizeDataAccessException exception) {
        if (exception.getActualSize() > 0) {
            return true;
        } else {
            return false;
        }
    }
    return true;
}