Skip to main content
Jump to: navigation, search

Acquiring and Using Sessions at Run Time (ELUG)

Revision as of 09:17, 19 October 2007 by (Talk | contribs) (sample page)

Acquiring and Using Sessions at Run Time

After you create and configure sessions, you can use the session manager to acquire a session instance at run time.

Introduction to Session Acquisition

We recommend that you export session instances from the EclipseLink Workbench to one or more uniquely named sessions.xml files and then use the session manager to load sessions from these sessions.xml files.

The EclipseLink session manager lets you build a series of sessions that are maintained under a single entity. The session manager is a static utility class that loads EclipseLink sessions from the sessions.xml file, caches the sessions by name in memory, and provides a single access point for EclipseLink sessions. The session manager supports the following session types:

  • Server Session
  • Database Session
  • SessionBroker

Session Manager

When a client application requires a session, it requests the session from the EclipseLink session manager. The two main functions of the session manager are to instantiate EclipseLink sessions for the server, and to hold the sessions for the life of the application. The session manager instantiates database sessions, server sessions, or session brokers based on the configuration information in the sessions.xml file.

The session manager instantiates sessions as follows:

  • The client application requests a session by name.
  • The session manager looks up the session name in the sessions.xml file. If the session name exists, the session manager instantiates the specified session; otherwise, it throws an exception.
  • After instantiation, the session remains viable until the application is shut down.

Acquiring the Session Manager

Acquiring a Session from the Session Manager

Acquiring a Client Session

Acquiring a Historical Session

Logging In to a Session

Using Session API

Logging Out of a Session

Storing Sessions in the Session Manager Instance

Destroying Sessions in the Session Manager Instance

Copyright © 2007 Oracle. EclipseLink Developer's Guide License.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.