0
任何人都可以解釋如何將下面的代碼轉換爲JDK 7風格autoclosable ???java 7 closeable PreparedStatement
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);
}