Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Creating a Server Session

Oracle recommends that you create server sessions using TopLink Workbench (see "Using TopLink Workbench").

After you create a server session, you create a client session by acquiring it from the server session (see "Acquiring a Client Session").

Using TopLink Workbench

Before you create a server session, you must first create a sessions configuration (see "Creating a Sessions Configuration").

Creating a Session

To create a new TopLink server session, use this procedure:

  1. Select the sessions configuration in the Navigator window in which you want to create a session.

  2. Add session button.
    Click Add Session on the toolbar. The Create New Session dialog box appears.

    You can also create a new server session by right-clicking the sessions configuration in the Navigator and selecting New > Session from the context menu, or by clicking Add Session on the Sessions Configuration property sheet.

    Figure 76-3 Create New Session Dialog Box

    Description of Figure 76-3  follows
    Description of "Figure 76-3 Create New Session Dialog Box"

  3. Enter data in each field on the Create New Session dialog box.

Use the following information to enter data in each field of the dialog box:

Field Description
Name Specify the name of the new session.
Use Server Platform Check this field if you intend to deploy your application to a J2EE application server.

If you check this field, you must configure the target application server by selecting a Platform.

    Platform This option is only available if you check Use Server Platform.

Select the J2EE application server to which you will deploy your application.

TopLink supports the following J2EE application servers:

  • OC4J 10.1.3

  • OC4J 10.1.2

  • OC4J 9.0.4

  • OC4J 9.0.3

  • WebLogic 8.1

  • WebLogic 7.0

  • WebLogic 6.1

  • WebSphere 6.0

  • WebSphere 5.1

  • WebSphere 5.0

  • WebSphere 4.0

  • Custom

The server platform you select is the default server platform for all sessions you create in this sessions configuration. At the session level, you can override this selection or specify a custom server platform class (see "Configuring the Server Platform").

Select Data Source Select the data source for this session configuration. Each session configuration must contain one data source. Choose one of the following:
  • Database to create a session for a relational project.

  • EIS to create a session for an EIS project.

  • XML to create a session for an XML projectFoot 1 .

See "TopLink Project Types" for more information.

Select Session Select Server Session to create a session for a single data source (including shared object cache and connection pools) for multiple clients in a three-tier application.

Footnote 1 You cannot create a server session for an XML project.

Using Java

You can create a server session in Java code using a project. You can create a project in Java code, or read a project from a project.xml file.

Example 76-1 illustrates creating an instance (called serverSession) of a Server class using a Project class.

Example 76-1 Creating a Server Session from a Project Class

Project myProject = new Project();
Server serverSession = myProject.createServerSession();

Example 76-2 illustrates creating an instance (called serverSession) of a Server class using a Project read in from a project.xml file.

Example 76-2 Creating a Server Session from a project.xml File Project

Project myProject = XMLProjectReader.read("myproject.xml");
Server serverSession = myProject.createServerSession();

Example 76-3 illustrates creating a server session with a specified write connection pool minimum and maximum size (when using TopLink internal connection pooling). The default write connection pool minimum size is 5 and maximum size is 10.

Example 76-3 Creating a Server Session with Custom Write Connection Pool Size

XMLProjectReader.read("myproject.xml");
Server serverSession = myProject.createServerSession(32, 32);