try {
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
shouldClose = false;
} catch (SQLException e) {
throw new DAOException(e);
} finally {
if (shouldClose) {
close(rs);
close(ps);
return null;
}
}
DataMapper<ResultSet, Postgres9Entity> mapper = new DataMapper<ResultSet, Postgres9Entity>() {
@Override
public Postgres9Entity map(ResultSet rs) throws DAOException {
try {
String id = rs.getString(1);
int version = rs.getInt(2);
byte[] body = rs.getBytes(3);
byte[] opt = rs.getBytes(4);
Timestamp updatedAt = rs.getTimestamp(5);
return new Postgres9Entity(id, version, body, opt, updatedAt != null ? new DateTime(updatedAt.getTime()) : null);
} catch (SQLException e) {
throw new DAOException(e);
}
}
@Override
public ResultSet unmap(Postgres9Entity t) throws DAOException {