private int testId = -1;
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
List result = new ArrayList();
int lastTestId = -1;
Test test = null;
ResultSet rs = ps.executeQuery();
while (rs.next()) {
testId = rs.getInt("TestId");
if (testId != lastTestId) {
test = new Test();
test.setTestId(testId);
test.setName(rs.getString("Name"));
test.setDetails(new ArrayList());
}
TestDetail td = new TestDetail();
td.setData(rs.getString("Data"));
td.setTest(rs.getInt("Test"));
td.setTestDetailId(rs.getInt("TestDetailId"));
test.getDetails().add(td);
}
return result;
}
});