Can anyone explain how to convert following code to JDK 7 style autoclosable???
PreparedStatement p = = conn.prepareStatement("INSERT INTO myTable(colName) VALUES(?)", Statement.RETURN_GENERATED_KEYS);
p.setObject(1, obj);
int r = p.executeUpdate();
ResultSet rs = p.getGeneratedKeys();
if (null != rs && rs.next()) {
activityInfoId = rs.getLong(1);
}
well found that you can not use statements like p.setObject(1,obj) in try ( … )