Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355171

Summary: Executing JDBC statements using DatabaseAccessor in SessionEventListener.preReleaseConnection with external pool causes infinte loop
Product: z_Archived Reporter: Doug Clarke <douglas.clarke>
Component: EclipselinkAssignee: 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:

Description Doug Clarke CLA 2011-08-18 17:26:06 EDT
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));
    }
Comment 1 Tom Ware CLA 2011-09-09 09:05:52 EDT
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.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:20:48 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink