Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
TopLink raises a SessionEvent.PreReleaseExclusiveConnection
event after you call the isolated session method release
.
If you are using Oracle Database proxy authentication (see "Oracle Database Proxy Authentication"), then you do not need to implement this session event handler.
If you are not using Oracle Database proxy authentication, then as part of the isolated session life cycle, you must implement a SessionEventListener
for SessionEvent.PreReleaseExclusiveConnection
.
Note: You must add this session event listener to the server session from which you acquire your isolated client session. You cannot add them to the isolated client session itself. For more information, see "Configuring Session Event Listeners" |
The SessionEvent.PreReleaseExclusiveConnection
event listener gives you an opportunity to interact with the underlying database platform: for example, to perform any VPD-specific cleanup such as executing PL/SQL to delete VPD packages or context information.
Example 80-1 illustrates a typical session event listener used to handle preReleaseExclusiveConnection
events for an isolated session.
Example 80-2 Session Event Listener for an Isolated Session
class VPDEventListener extends SessionEventAdaptor{
public void preReleaseExclusiveConnection(SessionEvent event){
Session session event.getSession();
// Make the Stored Procedure call for VPD to reset the Context Information
session.executeNonSelectingSQL("StoreProcResetContext()");
}
}
To get the required user credentials, use ClientSession
method getConnectionPolicy
to get the associated ConnectionPolicy
, and then use ConnectionPolicy
method getProperty
. The ConnectionPolicy
associated with the ClientSession
should contain all required user credentials (see "Configuring Connection Policy").
After you implement the required SessionEventListener
, add it to the parent server session, from which you acquire your isolated client session. For more information, see "Configuring Session Event Listeners".