EJBDEPLOY relationships – troubleshooting tips

Use this information to troubleshoot information for EJBDEPLOY problems.

[z/OS]

DB2 for z/OS version 7.x

Problems might exist when EJBDeploy creates a data relationship in DB2® for z/OS® Version 7.x. EJBDeploy creates a table with a composite of the two primary keys of the EJBs that are related to each other. If the composite keys are larger than 254 characters, DB2 for z/OS V7.x does not accept this relationship and the following error can occur:
DSNT408I SQLCODE = -613, ERROR:  THE PRIMARY KEY OR A UNIQUE CONSTRAINT 
IS TOO LONG OR HAS TOO MANY COLUMNS                                         
DSNT418I SQLSTATE   = 54008 SQLSTATE RETURN CODE              
This problem can be seen when the primary keys that are created for the two related beans have primary keys that are strings. This results in the composite being made up of 2 varchar(250) primary keys for a total of 500, which is greater than 254 maximum in DB2 for z/OS Version 7.x.
Things to consider when utilizing top-down mappings to ensure you do not experience this problem:
  • Top-down mappings are a guideline and must be reviewed with the DBA.
  • Schemas that are created top-down by EJBDeploy are designed only for testing, and as a guideline for the actual schema required. The use of the meet-in-the-middle mapping does not present this problem.
  • The composite key constraint problem is not experienced when using DB2 V8, which has 2K maximum key lengths.

EJBDEPLOY_JVM_ARGS:

Set the EJBDEPLOY_JVM_ARGS property to override Java™ virtual machine (JVM) options that are passed to the code that deploys EJBs (ejbdeploy.sh). Set this property in one of the following locations: deploymentmanager/bin/setupCmdLine.sh or appServerHome/bin/setupCmdLine.sh

For example, the following specifies that unqualifed SQL should be generated:
export EJBDEPLOY_JVM_ARGS="-DEJBDEPLOY_GENERATE_UNQUALIFIED_SQL=true" 

The converter that is defined for the primary key is not invoked on its foreign key value

The mapping for primary key fields to database columns may use a converter to transform the key values. If a container-managed persistence (CMP) bean uses a converter to map its primary key, and that bean has a relationship where the bean at the other end holds a foreign key, the mapping for the foreign key will not use the converter.

The following errors might occur, indicating that the converter defined for the primary key is not invoked on its foreign key value. During the run of the ejbDeploy command , you receive the following message:
No type mapping defined for Java datatype1 to Database datatype2
During run time, the application does not find the CMP bean at the other end of the relationship.

To work around this limitation, define your own foreign key in the database table, and create a mapping that uses the same converter as defined for the primary key on the enterprise beans at the other end of its relationship.

Limitation when you use the EJBDeploy command with Java 8

[8.5.5.14 or later]The EJBDeploy tool does not support Java 8 in Version 8.5.5.8 and earlier of the application server. For Version 8.5.5.9 and later of the application server, you have the following options when you deploy EJB applications that are Version 2.1 or earlier:
  • For Version 8.5.5.9 through Version 8.5.5.13 of the application server, Java 8 support is enabled by installing the PI73197 interim fix.
  • For Version 8.5.5.14 and later versions of the application server, Java 8 support is enabled by default.

[8.5.5.14 or later]If you need Java 8 but you cannot install the PI73197 interim fix or Version 8.5.5.14, you have four options when you deploy EJB applications:

  • If the application is not modified and the generated deployment code is running on Java 6 or Java 7, regeneration of the deployment code is not required. You can deploy existing applications on an application server that is running Java 8.
  • If the EJB interfaces in the application are modified, you must prepare the application for deployment by using the EJBDeploy command. In this situation, run the EJBDeploy command with Java 6 or Java 7 before you deploy the application.

    Running the EJBDeploy command in this situation has no behavioral changes for the application or other impact on the application.

    1. Compile the EJB application with Java 6 or Java 7.
    2. Configure the application server with Java 6 or Java 7 by using the managesdk command.
    3. Run the EJBDeploy command on the application.
    4. Deploy the generated artifacts from the previous step onto the application server that is configured with Java 8.
  • If a strict requirement exists to use Java 8 for compilation or if the application needs to use new features of Java 8, you can upgrade to Version 9 of the application server. V9 supports Java 8 exclusively. The EJBDeploy command is also supported on Java 8.
  • If you do not want to upgrade to Version 9 of the application server, you must convert the application to EJB 3.0 or later. The EJBDeploy command is only required for container-managed persistence (CMP), bean-managed persistence (BPM), and session beans that follow EJB 2.1 or earlier versions of the specification. Applications that use EJB 3.0 or later do not need to run the EJBDeploy command.