On the server, trying to get data from the table.
result = DBexecutor.executeQuery("SELECT * FROM mappacks WHERE ROWID >="+startWith+" AND ROWID <="+endWith+";" ); while (result.next()){ MapPackStructure mapPack = gson.fromJson((result.getString("JSON")), MapPackStructure.class); TreeMap pack = new TreeMap(){{ put("ID", mapPack.getID()); put("name", mapPack.getName()); put("author", mapPack.getAuthor()); put("preview", "/static/mappack/"+mapPack.getID()+"/png"); }}; ArrayList<TreeMap> levels = new ArrayList<>(); for(Integer levelID: mapPack.getMaps()) { ResultSet innerResult; innerResult = DBexecutor.executeQuery("SELECT * FROM levels WHERE ID =" + levelID + ";"); while (innerResult.next()) { levels.add(new TreeMap() {{ put("ID", innerResult.getString("ID")); put("name", innerResult.getString("name")); put("author", innerResult.getString("Author")); }}); } } pack.put("levels", levels); rendered += config.renderTemplate(template, pack); System.out.println(rendered); DBexecutor.close(); } //startWith = 1 endWith = 5 In total, there are 3 rows in the table, I get only one entry to the output, while the internal query works fine.
What is interesting, even if the query is "SELECT * FROM mappacks", I get only one entry
DBexecutor.close()methodDBexecutor.close()? Does he accidentally close all resources, includingresult(or the connection within which theresultwas obtained)? - Roman