62,628
社区成员
发帖
与我相关
我的任务
分享
public void testGetCountWithName() {
long lo = customerDAO.getCountWithName("mike3");
System.out.println(lo);
}
public long getCountWithName(String name) {
String sql = "SELECT count(name) FROM testmvc WHERE name = ?";
return getForValue(sql, name);
}
public <E> E getForValue(String sql, Object... args) {
Connection connection = null;
try {
connection = jdbcUtlis.getConnection();
return (E) queryRunner.query(connection, sql, new ScalarHandler(),
args);
} catch (Exception e) {
e.printStackTrace();
} finally {
jdbcUtlis.releaseConnection(connection);
}
return null;
}
