Skip Headers

# Logging In to a Session

Previous

Next

Before you can use a session, you must first log in to the session using `Session` method `login`.

By default, when you load a session using the session manager, TopLink automatically logs in to the session using the zero-argument `login` method. For information on loading a session without automatically logging into the session, see "Loading a Session Without Logging In".

If you load a session without logging in, you can choose from the following signatures of the `login` method:

- `login()`: Use the Login, user name, and password defined in the corresponding `sessions.xml` file.

- `login(Login login)`: Override the `Login` defined in the corresponding `sessions.xml` file with the specified `Login`.

- `login(String username, String password)`: Override the user name and password defined in the corresponding `sessions.xml` file with the specified user name and password.

When you log in to a session broker, the session broker logs in all contained sessions and initializes the descriptors in the sessions. After login, the session broker appears and functions as a regular session. TopLink handles the multiple database access transparently.