String sql = "SELECT *, (SELECT COUNT(DISTINCT customer_id) FROM " +quoteTable("customer_ip")
+ " ci WHERE ci.ip = cib.ip) AS total FROM " +quoteTable("customer_ip_blacklist")+" cib";
//sortedKeys={"ip"}
QueryBean query = createPaginationQuery(sql, pageParam);
List<IpBlacklist> blacklists = getJdbcOperations().query(query.getSql(),
query.getParameters(), new IpBlacklistRowMapper(){
@Override
public IpBlacklist mapRow(ResultSet rs, int rowNum)
throws SQLException {
IpBlacklist blacklist = super.mapRow(rs, rowNum);
blacklist.setTotalCustomers(rs.getInt("total"));