IBM Support

JPA tools do not support DB2 Table Aliases

Troubleshooting


Problem

JPA Tools do not recognize the DB2 Table Aliases as valid table references for entity beans.

Symptom

DB2 Table Aliases are not listed in the Tables section, in the Generate Custom Entities wizard.
Using table annotations such as @Table(name="my_alias") to specify valid DB2 Table Aliases can result in validation errors.

Cause

JPA Tools does not support DB2 Table Aliases.

Refer to the 'Generation of JPA entities from DB2 alias' enhancement in the related URL section

Diagnosing The Problem

NOTE: You require a connection to a DB2 instance containing at least one table alias.

1) Start Rational Application Developer
2) Open (or create a new) JPA project, with the database connection set to the DB2 instance.
3) Right click on the JPA project > JPA Tools > JPA Entities from Tables...
4) Click Next
5) Ensure the connection is set to to the DB2 instance and select the schema containing the table alias.

The alias is not displayed in the Tables section.

Resolving The Problem

There are two alternatives to work around the problem with the reference(s) that are not resolved:

  • Use the table name(s) instead of the table alias(es).
  • Turn off JPA validation:
1. Open Preferences dialog (Windows > Preferences)
2. Go to the Validation page
3. Deselect the Build checkbox for JPA Validator:

[{"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Database Tooling","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"},{"code":"PF022","label":"OS X"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.4.1;8.0.4.2;8.5;8.5.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21634270