[Version 5.0.2 and later]Applying Container Managed Persistence services over anything

Steps for this task

  1. Develop your Container Managed Persistence (CMP) bean as usual. See Developing enterprise beans for more information.
    Optionally, you can also define abstract methods that are treated as pushdown methods.
  2. Assemble the Enterprise JavaBean (EJB) Java Archive (JAR) file. In addition to standard packaging steps, make sure to set the proper deployment descriptor settings.

    Note: Ensure that you have Enabled Server Target support for J2EE projects and that you set the target server as Integration Server v5.1. Without properly setting one of these target servers the panels listed in the following steps night not appear. Furthermore, after enabling or changing the target server you might need to close and re-open any currently open Deployment Descriptor Editors for these changes to be reflected in the given Deployment Descriptor Editor. Note that Pushdown support is only available when the server target is Integration Server v5.1.

    1. Use the Assembly Toolkit to make your settings.
    2. There is a PushDownContainerManagedEntityExtension method associated with your CMP bean, and its procedural attribute is set to True. Set its backEndType attribute to one of the following:
      CCI
      Creates skeleton for the UserDefinedPushDownMethodsImpl java file with some boiler-plate CCI code generated.
      EJB
      Creates skeleton for the UserDefinedPushDownMethodsImpl java file with some boiler-plate EJB code generated.
      JAX-RPC
      Creates skeleton for the UserDefinedPushDownMethodsImpl java file with some boiler-plate JAX-RPC code generated.
      WSIF
      Creates skeleton for the UserDefinedPushDownMethodsImpl java file with some boiler-plate WSIF code generated.
      Custom
      Creates empty skeleton for the UserDefinedPushDownMethodsImpl java file.
    3. Set additional attributes required for each backEndType.
      You are prompted for attributes according to which backEndType you specified.
      CCI
      Set your bean's connectionSpecClassName attribute to the appropriate fully-qualified J2EE Connector Architecture (JCA) ConnectionSpec class name. For example, the class name for use with CICS ECI is com.ibm.connector2.cics.ECIConnectionSpec.

      Set the interactionSpecClassName attribute to the appropriate fully-qualified J2EE Connector Architecture (JCA) InteractionSpec class name. For example, the class name for use with CICS ECI is com.ibm.connector2.cics.ECIInteractionSpec.

      EJB
      Set the ejbRefName value that specifies the java:comp name for a reference to another EJB. For example, ejb/AccountBackend.
      JAX-RPC
      Set the wsdlServiceFileName attribute to the fully-qualified path (inside a JAR file) to a WSDL file that defines the web service being used.
      WSIF
      Set the wsdlServiceFileName attribute to the fully-qualified path (inside a JAR file) to a WSDL file that defines the web service being used.
      Custom
      No special attributes.
      All backend types
      All backend types have an ejbToRAAdapterClassName entry, which enables you to specify a fully-qualified class name of a custom EJBToRAAdapter implementation.
    4. If you defined any abstract methods for pushdown, define a PushDownMethodElement for each of them, and set the backEndMethodName attribute to the name of the corresponding method.
  3. Deploy the EJB JAR.
    1. Run the code generation tool CMPDeploy against the assembled EJB JAR file. You can do this from within the IDE or from the command line.
      The command syntax is:
      CMPDeploy  <ejb.jar | application.ear> <-dir directory> <-overwrite> <-verbose>

      ejb.jar | application.ear
      The name of the JAR or EAR file you want to deploy.
      -dir
      Optional. The name of the directory into which you want the output files placed.

      If you do not specify -dir the tool outputs its files into a package-based directory structure rooted at the current directory.

      -overwrite
      Optional. Causes any existing UserDefinedPushDownMethodsImpl class to be overwritten by the one you are creating.

      If you do not specify -overwrite the tool will abort the process with a warning message if the UserDefinedPushDownMethodsImpl class already exists.

      -verbose
      Optional. Causes tracing messages to display during processing.

      If you do not specify the -verbose option the tool does not display tracing messages, but only displays a message at the end of the process specifying either what was emitted or else what problems were encountered.

      This command accepts either an EAR or JAR file, and generates the UserDefinedPushDownMethods interface, and skeleton Java source code for the bean's UserDefinedPushDownMethodsImpl class. For example, if the EJB JAR contains a procedural CMP bean called Account, then CMPDeploy Account.jar emits a generic AccountUserDefinedPushDownMethods interface, and a backend specific AccountUserDefinedPushDownMethodsImpl.java class that implements the interface.

  4. Edit the emitted implementation class.
    Enter the appropriate connectivity logic for your specified backend data store.
  5. Compile the emitted files.
  6. Zip/jar the compiled files into the EJB JAR file.
  7. Run the EJB deployment tool against the EJB JAR file. For more information, see EJB deployment tool.
  8. Package the deployed EJB JAR file into an EAR file.
  9. Install the application containing this EJB EAR file.
    During installation, when asked for the resource binding for the CMP bean, specify the JNDI name of a J2C ConnectionFactory (instead of the usual case of specifying the JNDI name of a JDBC Data Source). For a CCI based CMP/A bean, this is a J2C ConnectionFactory scoped underneath a JCA 1.0 compliant resource adapter (a .rar file, such as for CICS or IMS). Note that your CMP/A bean is only transactional if you are using a transactional resource adapter. In the case of a resource adapter that only supports single-phase commit (non-XA) transactions, if you need your transactions to also include one or more beans capable of two-phase commit (XA) transactions, then you should assemble your application to enable Last Participant Support.

    For a non-CCI based CMP/A bean (one that does NOT use JCA connectors, such as one with a backEndType of EJB, JAX-RPC, WSIF, or Custom), you must install the WebSphere Procedural Resource Adapter provided with WebSphere Business Integration Server Foundation Version 5.1, and specify a binding to it. To do this, you need to install the WebSphere/AppServer/installableApps/cmpaAdapter.rar file.

    1. Open the administrative console
    2. Choose Resources > Resource Adapters > Install RAR.
    3. Install WebSphere/AppServer/installableApps/cmpaAdapter.rar.
    4. Create a J2C Connection Factory underneath it.
      Specify a JNDI name for the factory. During the application installation, you must specify the same JNDI name as your CMP/A bean's datasource.

      Note: Such beans are inherently non-transactional, and should be marked with a transaction policy of NotSupported, unless your UserDefinedPushDownMethodsImpl code (or code called from it) registers with JTA. For non-transactional CMP/A beans, you must use Compensation to enable transaction rollback functionality.


Related reference
Example: Container Managed Persistence over anything -- CCI
Example: Container Managed Persistence over anything -- EJB



Searchable topic ID:   tejb_cmpa
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/ae/tejb_cmpa.html

Library | Support | Terms of Use | Feedback