log.info("received max id from table " + tableName + ", setting value in PK_TABLE to " + v);
if (log.isDebugEnabled()) log.debug("received max id from table " + tableName + ", setting value in PK_TABLE to " + v);
    private static int maxIdFromTable(String ename) {        EOEntity entity = EOModelGroup.defaultGroup().entityNamed(ename);        if (entity == null) throw new NullPointerException("could not find an entity named " + ename);        String tableName = entity.externalName();        String sql = "select max(id) from " + tableName;        Connection con = ERXJDBCConnectionBroker.connectionBrokerForEntityNamed(ename).getConnection();        ResultSet resultSet;        try {            resultSet = con.createStatement().executeQuery(sql);            con.commit();            boolean hastNext = resultSet.next();            if (hastNext) {                int v = resultSet.getInt(1);                log.info("received max id from table " + tableName + ", setting value in PK_TABLE to " + v);                return v;            }            throw new IllegalStateException("could not get value from " + sql);        } catch (SQLException e) {            log.error("could not call database with sql " + sql, e);            throw new IllegalStateException("could not get value from " + sql);        } finally {            ERXJDBCConnectionBroker.connectionBrokerForEntityNamed(ename).freeConnection(con);        }    }