e.printStackTrace();
if(log.isErrorEnabled()) { log.error("Exception: ", e); }
    protected String getNextId(String queryName, String prefix) {        DecimalFormat format = new DecimalFormat("0000");        format.setPositivePrefix(prefix);        substitutions.put(":max_id_pattern:", prefix + "____");        String id = format.format(1); // Default        try {            Statement stmt = dbConnection.createStatement();            try {                String query = dbp.getQuery(queryName, substitutions);                ResultSet rs = executeQuery(stmt, query);                try {                    if (rs.next()) {                        String maxId = rs.getString(1);                        if (maxId != null) {                            int n = format.parse(maxId).intValue();                            id = format.format(n + 1);                        }                    }                } finally {                    rs.close();                }            } finally {                stmt.close();            }        } catch (Exception e) {            e.printStackTrace();            // Ignore exceptions and use default        }        return id;    }