Saturday, November 21, 2009

ADF : getConnection

ADF 11g : How to get the current connection in ADF?

//put the code into XXXImpl.java (AM)

private Connection getCurrentConnection() throws SQLException {
/* Note that we never execute this statement, so no commit really happens */
PreparedStatement st = getDBTransaction().createPreparedStatement("commit",1);
Connection conn = st.getConnection();
st.close();
return conn;
}