| Summary: | Executing JDBC statements using DatabaseAccessor in SessionEventListener.preReleaseConnection with external pool causes infinte loop | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Doug Clarke <douglas.clarke> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
When invoking a JDBC statement within SessionEventListener.preReleaseConnection with an external pool the execute call on the DatabaseAccessor results in a call to the preReleaseConnection event. This results in an infinte loop. PROBLEM CODE: @Override public void preReleaseConnection(SessionEvent event) { DatabaseAccessor accessor = (DatabaseAccessor) event.getResult(); SQLCall call = new SQLCall("CALL DBMS_SESSION.CLEAR_IDENTIFIER()"); call.returnNothing(); accessor.executeCall(call, new DatabaseRecord(), (AbstractSession) event.getSession()); } WORK-AROUND: @Override public void preReleaseConnection(SessionEvent event) { DatabaseAccessor accessor = (DatabaseAccessor) event.getResult(); execute((AbstractSession) event.getSession(), accessor, "CALL DBMS_SESSION.CLEAR_IDENTIFIER()"); } private void execute(AbstractSession session, DatabaseAccessor accessor, String sql) { try { PreparedStatement statement = accessor.getConnection().prepareStatement(sql); statement.executeUpdate(); } catch (SQLException e) { throw new RuntimeException("OracleVPDListener::" + sql + " FAILED", e); } session.log(new SessionLogEntry(SessionLog.FINE, SessionLog.SQL, session, sql, new String[0], accessor, false)); }