String q = "SELECT MAX("+map.getIDField()+") FROM "+map.getTableName();
String q = new StringBuffer("SELECT MAX(") .append(map.getIDField()) .append(") FROM ") .append(map.getTableName()) .toString();
    public synchronized String generateMaxID (DbMapping map) throws Exception {	// Transactor tx = (Transactor) Thread.currentThread ();	// tx.timer.beginEvent ("generateID "+map);	String retval = null;	Statement stmt = null;	try {	    Connection con = map.getConnection ();	    String q = "SELECT MAX("+map.getIDField()+") FROM "+map.getTableName();	    stmt = con.createStatement ();	    ResultSet rs = stmt.executeQuery (q);	    // check for empty table	    if (!rs.next()) {	        long currMax = map.getNewID (0);	        retval = Long.toString (currMax);	    } else {	        long currMax = rs.getLong (1);	        currMax = map.getNewID (currMax);	        retval = Long.toString (currMax);	    }	} finally {	    // tx.timer.endEvent ("generateID "+map);	    if (stmt != null) try {	        stmt.close ();	    } catch (Exception ignore) {}	}	return retval;    }