11 Deploying a TopLink Application

This chapter includes deployment information on various types of TopLink applications.

This chapter includes the following sections:

For more information, see the following:

11.1 Deploying Java Applications

Build the JAR file (see Section 10.1, "Packaging Java Applications") and place it on the classpath.

For more information on accessing TopLink from your client application, see Chapter 90, "Acquiring and Using Sessions at Run Time".

11.2 Deploying JavaServer Pages and Servlets

After you build the WAR and JAR files (see Section 10.2, "Packaging JavaServer Pages and Servlet Applications"), build them into an EAR file for deployment. To deploy the EAR to your JSP servlet server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

For more information on accessing TopLink from your client application, see Section 90.3.2, "How to Load a Session from sessions.xml with an Alternative Class Loader".

11.3 Deploying Session Bean Applications

After you build the WAR and JAR files (see Section 10.3, "Packaging Session Bean Applications"), build them into an EAR file for deployment. To deploy the EAR file to your Java EE server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

For more information on accessing TopLink from your client application, see Section 90.3.2, "How to Load a Session from sessions.xml with an Alternative Class Loader".

Optionally, you may also consider Section 11.7, "Performing Hot Deployment of EJB".

11.4 Deploying JPA Applications

After you packaged your JPA application, deploy it to an application server of your choice.

For more information, see "Deploying an EclipseLink JPA Application" section of EclipseLink Developer's Guide at http://wiki.eclipse.org/Packaging_and_Deploying_EclipseLink_JPA_Applications_%28ELUG%29#Deploying_an_EclipseLink_JPA_Application.

11.5 Deploying CMP Applications

After you build the WAR and JAR files (see Section 10.6, "Packaging CMP Applications"), build them into an EAR file for deployment. To deploy the EAR file to your Java EE server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

This section describes How to Deploy a CMP Application to OC4J.

For additional information on server-specific configuration, see Chapter 8, "Integrating TopLink with an Application Server".

Optionally, you may also consider Section 11.7, "Performing Hot Deployment of EJB".

11.5.1 How to Deploy a CMP Application to OC4J

For more information, see Oracle Fusion Middleware Administrator's Guide.

When you deploy a CMP application to OC4J, the following happens:

  • OC4J performs a partial EJB conformance check on the beans and their associated interfaces.

  • OC4J builds the internal OC4J classes that manage security and transactions, as well as the RMI stubs and skeletons that enable client access to the beans.

  • TopLink builds concrete bean subclasses and EJB finder method implementations.

11.6 Deploying BMP Applications

After you build the WAR and JAR files, build them into an EAR file for deployment. To deploy the EAR file to your Java EE server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

For additional information on server-specific configuration, see Chapter 8, "Integrating TopLink with an Application Server".

Optionally, you may also consider Section 11.7, "Performing Hot Deployment of EJB".

11.7 Performing Hot Deployment of EJB

Many Java EE containers support hot deployment, a feature that enables you to deploy EJB on a running server. Hot deployment allows you to do the following:

  • Deploy newly developed EJB to a running production system.

  • Remove (undeploy) deployed EJB from a running server.

  • Modify (redeploy) the behavior of deployed EJB by updating the bean class definition.

The client receives deployment exceptions when attempting to access undeployed or re-deployed bean instances. The client application must catch and handle the exceptions.

How you configure hot deployment of EJB depends on the type of Java EE application you are deploying:

For more information about hot deployment, see the Java EE container documentation.

11.7.1 How to Perform Hot Deployment in a CMP Application

When you take advantage of hot deployment in a CMP application, consider the following:

  • You must deploy all related beans (all beans that share a common TopLink project) within the same EJB JAR file. Because TopLink views deployment on a project level, deploy all the project beans (rather than just a portion of them) to maintain consistency across the project.

  • When you redeploy a bean, you automatically reset its TopLink project. This flushes all object caches and rolls back any active object transactions associated with the project.

11.7.2 How to Perform Hot Deployment in a POJO Application

When you take advantage of hot deployment in a POJO application, you must refresh the TopLink session using the SessionManager method getSession with the appropriate arguments (see Section 90.3.6, "How to Refresh a Session when the Class Loader Changes".

If you do not use this SessionManager method, then your application is responsible for destroying or refreshing the session when a hot deployment (or hot redeployment) occurs.