try {
ps = conn.prepareStatement("SELECT content FROM submission WHERE submission_id=?");
ps.setLong(1, id);
ResultSet rs = ps.executeQuery();
if (!rs.next()) {
throw new PersistenceException("Submission id " + id + " not found");
}
String content = rs.getString("content");
if (content == null) {
return "";
} else {
return content;
}
} finally {
Database.dispose(ps);
}
} catch (SQLException e) {
throw new PersistenceException("Failed to get the submission with id " + id, e);
} finally {
Database.dispose(conn);
}
}