5 Accessing and Retrieving Relational Data

TopLink Grid marries the standardization and simplicity of application development using the Java Persistence API (JPA) with the scalability and distributed processing power of Oracle's Coherence Data Grid. Developers can leverage their investment in JPA and take advantage of the scalability of Coherence. Standard JPA applications interact directly with their primary data store, typically a relational database, but with TopLink Grid developers can choose to store some or all of their domain model in the Coherence data grid.

To Use TopLink-Grid with Application Server-Scoped Cluster Nodes

If you are using TopLink Grid to store JPA (Java Persistence API) Entities in Coherence caches, follow these steps:

  1. Follow the instructions in "Packaging Applications and Configuring Application Server-Scoped Cluster Nodes" to include coherence.jar and active-cache.jar in the system classpath.

  2. Edit your WebLogic Server system classpath to include toplink-grid.jar in the system classpath.

To Use TopLink Grid with EAR-Scoped Cluster Nodes

If you are using TopLink Grid to store JPA (Java Persistence API) Entities in Coherence caches, follow these steps:

  1. Follow the instructions in "Packaging Applications and Configuring EAR-Scoped Cluster Nodes" to deploy the coherence.jar and active-cache.jar files as shared libraries.

  2. Use either of the following methods to deploy toplink-grid.jar as a shared library.

    • Use the WebLogic Server Administration Console or the command line to deploy toplink-grid.jar as a shared library.

      java weblogic.Deployer -username <> -password <> -adminurl <> -deploy toplink-grid.jar -name toplink-grid -library -targets <>
      

      If you deploy toplink-grid.jar as a shared library, refer to it in the weblogic-application.xml file as a library-ref. Example 5-1 illustrates the toplink-grid.jar referenced in the weblogic-application.xml file.

      Example 5-1 Reference to toplink-grid.jar in the weblogic-application.xml File

      <weblogic-application>
      ...
        <library-ref>
          <library-name>coherence</library-name>
        </library-ref>
         ...
        <library-ref>
          <library-name>active-cache</library-name>
        </library-ref>
        <library-ref>
          <library-name>toplink-grid</library-name>
        </library-ref>
      ...
      </weblogic-application>
      
    • Copy toplink-grid.jar to the application EAR's APP-INF/lib folder. However, the preferred way is to deploy it as a shared library.

To Use TopLink Grid with WAR-Scoped Cluster Nodes

If you are using TopLink Grid to store JPA (Java Persistence API) Entities in Coherence caches, follow these steps:

  1. Follow the instructions in "Packaging Applications and Configuring WAR-Scoped Cluster Nodes" to deploy the coherence.jar and active-cache.jar files.

  2. Use the WebLogic Server Administration Console or the command line to deploy toplink-grid.jar. The following is a sample command line:

    java weblogic.Deployer -username <> -password <> -adminurl <> -deploy toplink-grid.jar -name toplink-grid -library -targets <>
    
  3. Import toplink-grid.jar as an optional package in the manifest.mf file of each module that will be using Coherence. As an alternative, you can copy it to each of the application WAR's WEB-INF/lib directories.

    Example 5-2 illustrates a sample manifest file.

    Example 5-2 Manifest File with coherence, active-cache, and toplink-grid

    Manifest-Version: 1.0
    Extension-List: coherence active-cache toplink-grid
    coherence-Extension-Name: coherence
    active-cache-Extension-Name: active-cache
    toplink-grid-Extension-Name: toplink-grid