Example usage for java.lang Long intValue

List of usage examples for java.lang Long intValue

Introduction

In this page you can find the example usage for java.lang Long intValue.

Prototype

public int intValue() 

Source Link

Document

Returns the value of this Long as an int after a narrowing primitive conversion.

Usage

From source file:cn.itcast.bbs.dao.TopicDao.java

public int countTopicByType(int id) throws SQLException {
    QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
    String sql = "select count(*) from topic where type_id = ?;";
    Long cnt = runner.query(sql, new ScalarHandler(), id);
    return cnt.intValue();
}

From source file:org.flywaydb.test.sample.spring3.BaseDBHelper.java

/**
 * Simple counter query to have simple test inside test methods.
 *
 * @return number of customer in database
 * @throws Exception/* w  ww  .  j  a  v a  2s . co m*/
 */
public int countCustomer() throws Exception {
    int result = -1;
    Statement stmt = con.createStatement();
    String query = "select count(*) from Customer";

    ResultSet rs = stmt.executeQuery(query);
    rs.next();
    Long cnt = rs.getLong(1);
    result = cnt.intValue();

    rs.close();
    stmt.close();

    return result;
}

From source file:org.flywaydb.test.sample.helper.BaseDBHelper.java

/**
 * Simple counter query to have simple test inside test methods.
 * /* w  ww . ja  v  a 2  s  .c  om*/
 * @return number of customer in database
 * @throws Exception
 */
public int countCustomer() throws Exception {
    int result = -1;

    Statement stmt = con.createStatement();
    String query = "select count(*) from Customer";

    ResultSet rs = stmt.executeQuery(query);
    rs.next();
    Long cnt = rs.getLong(1);
    result = cnt.intValue();

    rs.close();
    stmt.close();

    return result;
}

From source file:reviewbot.service.metadata.MiscService.java

@Override
public MiscDTO readOne(Long id) {
    return unwrap(_miscRepository.readOne(id.intValue()));
}

From source file:reviewbot.service.metadata.AwardService.java

@Override
public AwardDTO readOne(Long id) {
    return unwrap(_awardRepository.readOne(id.intValue()));
}

From source file:reviewbot.service.metadata.GenreService.java

@Override
public GenreDTO readOne(Long id) {
    return unwrap(_genreRepository.readOne(id.intValue()));
}

From source file:reviewbot.service.metadata.ThemeService.java

@Override
public ThemeDTO readOne(Long id) {
    return unwrap(_themeRepository.readOne(id.intValue()));
}

From source file:org.antbear.jee.wicket.persistence.PersonService.java

public int size() {
    Long ll = (Long) em.createQuery("select count(*) from Person").getSingleResult();
    return ll.intValue();
}

From source file:reviewbot.service.metadata.FormatService.java

@Override
public FormatDTO readOne(Long id) {
    return unwrap(_formatRepository.readOne(id.intValue()));
}

From source file:reviewbot.service.metadata.SubgenreService.java

@Override
public SubgenreDTO readOne(Long id) {
    return unwrap(_subgenreRepository.readOne(id.intValue()));
}