System.out.println("getNextId: "+query);
if (traceQueries) { System.out.println("getNextId: "+query); }
    public static String getNextId(String queryName, String prefix) {        DecimalFormat format = new DecimalFormat(prefix + "0000");	Map substitutions = new HashMap();        substitutions.put(":max_id_pattern", prefix + "____");        String id = format.format(1); // Default        try {	    Connection dbConnection = DBUtils.getConnection(QUERY_FILE);            Statement stmt = dbConnection.createStatement();            try {		if(dbp==null)		    dbp = DBProperties.readQueryFile(QUERY_FILE);                String query = dbp.getQuery(queryName, substitutions);		System.out.println("getNextId: "+query);		ResultSet rs = stmt.executeQuery(query);                try {                    if (rs.next()) {                        String maxId = rs.getString(1);                        if (maxId != null) {                            int n = format.parse(maxId).intValue();  			    System.out.println("getNextId: n="+n+", maxId ="+maxId);                            id = format.format(n + 1);  			    System.out.println("getNextId: id="+id);                        }                    }                } finally {                    rs.close();                }            } finally {                stmt.close();            }        } catch (Exception e) {            e.printStackTrace();            // Ignore exceptions and use default        }        return id;    }