Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B15901-01
A session represents the connection between an application and the relational database that stores its persistent objects. OracleAS TopLink provides different session classes, each optimized for different design requirements and data access strategies. OracleAS TopLink session types range from a simple database session that gives one user one connection to the database, to the session broker that provides access to several databases for multiple clients.
To understand the OracleAS TopLink session, you must be familiar with several session concepts.
In most cases, you pre-configure sessions for the application in a session configuration file. This file, known as the
sessions.xml file, is an Extensible Markup Language (XML) file that contains all sessions that are associated with the application. The
sessions.xml file can contain any number of sessions and session types.
Several session types each provide a particular set of functionality to the application.
A server session is the most common OracleAS TopLink session type, because it supports the three-tier architectures that are common to enterprise applications. Server sessions manage the server side of client-server communications. They work together with the client session to provide complete client-server communication.
The server session provides shared resources to a multithreaded environment, including a shared cache and connection pools. The server session also provides transaction isolation.
For more information about the server session, see "Server Session and Client Session".
A client session is a client-side communications mechanism that works together with the server session to provide the client-server connection. Each client session serves one client.
For more information about the client session, see "Server Session and Client Session".
A remote session offers database access to clients that do not reside on the OracleAS TopLink Java Virtual Machine (JVM). The remote session connects to a client session, which, in turn, connects to the server session.
For more information, see "Remote Session".
A database session is a unique session type because it provides both client and server communications. It is a relatively simple session type that supports only a single client and a single database connection. The database session is not scalable; however, if you have an application with a single client that requires only one database connection, the database session is usually your best choice.
For more information, see "Database Session".
The OracleAS TopLink session broker is a mechanism that enables client applications to communicate with multiple databases. A session broker makes multiple database access transparent to the client.
For more information, see "Session Broker".
When a client application requires a session, it requests the session from the OracleAS TopLink session manager. The two main functions of the session manager are to instantiate OracleAS TopLink 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
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 raises an exception.
After instantiation, the session remains viable until you shut down the application.
A connection pool is a collection of reusable database connections. OracleAS TopLink manages these connections for the application, provides connections to processes as needed, and returns connections to the pool when the process is complete. When it is returned to the pool, the connection is available for other processes.
A properly configured connection pool significantly improves performance.
For more information about configuring connection pools, see "Working with Connection Pools" in the Oracle Application Server TopLink Mapping Workbench User's Guide.
OracleAS TopLink sessions provide an object cache. This cache, known as the session cache, retains information about objects that are read from or written to the database, and is a key element for improving the performance of an OracleAS TopLink application.