JSONObject topicData = new JSONObject();
JSONObject frameData = new JSONObject();
JSONObject frames = new JSONObject();
JSONObject all = new JSONObject();
JSONArray sorting = new JSONArray();
<BUG>ResultSet frameQueryRS = database.executeQuery(frameMap.getSQLString());
int topicId = -1;</BUG>
int counter = frameMap.offset;
while (frameQueryRS.next()) {
if (topicId != frameQueryRS.getInt("TOPIC_ID")) {

JSONObject topicData = new JSONObject();
JSONObject frameData = new JSONObject();
JSONObject frames = new JSONObject();
JSONObject all = new JSONObject();
JSONArray sorting = new JSONArray();
ResultSet frameQueryRS = database.executeQuery(frameMap.getSQLString());
System.out.println(frameMap.getSQLString());
int topicId = -1;
int counter = frameMap.offset;
while (frameQueryRS.next()) {
if (topicId != frameQueryRS.getInt("TOPIC_ID")) {
