cjgencmpsql (generate SQL statements for CMP2.x Entity Beans)
- Organization of this page
Format
cjgencmpsql [server-name] [-nameserver provider-URL]
-name application-name
[-resname EJB-JAR-display-name/Entity-Bean-display-name]
Function
This command generates SQL statements for CMP2.x Entity Beans.
If you execute this command, the following SQL statements are generated:
-
SQL statements that manipulate the table to which the CMP2.x Entity Beans were mapped
-
SQL statements that manipulate the CMR table
-
SQL statements generated from EJB QL
The cjgencmpsql command must be executed for CMP2.x Entity Beans at the following timing:
-
When there are no CMR relationships between the Beans
-
Map the fields for the CMP2.x Entity Beans to a table in the database (use the cjsetappprop command).
-
Execute the cjgencmpsql command to generate SQL statements for CMP2.x Entity Beans.
-
-
When there are CMR relationships between the Beans
-
Map the fields for all CMP2.x Entity Beans related to CMR to a table in the database (use the cjsetappprop command).
-
Execute the cjgencmpsql command to generate SQL statements for all the CMP2.x Entity Beans related to CMR.
-
If you change the CMR settings after the SQL statements are generated, you must execute the cjgencmpsql command and generate SQL statements for Beans related to the modified CMR settings before deploying the Beans.
This command can be executed only while the application is stopped.
When the application is in the exploded archive format, operations can be performed for a J2EE server that runs on the host same as the command execution host.
Arguments
- server-name
-
Specifies the name of a connected J2EE server. If the server name is omitted, the host name is assumed.
- -nameserver provider-URL
-
Specifies the access protocol for the CORBA Naming Service, the name of the host running the CORBA Naming Service, and the port number being used by the host. These items are specified in the following format:
protocol-name: : host-name: port-number
For details on the specification items, see 2.1.2 Provider URL.
- -name application-name
-
Specifies the application name.
- -resname EJB-JAR-display-name/Entity-Bean-display-name
-
Specifies the display name of the Entity Bean that becomes the target for SQL generation.
If this argument is omitted, all CMP2.x Entity Beans contained in the application become targets for SQL generation. This command attempts to generate SQL statements for all CMP2.x Entity Beans even if there is a CMP2.x Entity Bean for which SQL generation fails. If SQL generation fails for even one Entity Bean, the termination code becomes 1.
Input examples
cjgencmpsql MyServer -name App1 -resname EjbJar1/Ejb1
Return values
- 0:
-
The command terminated normally.
- 1:
-
The command terminated abnormally.
- 2:
-
The command could not be executed because of an exclusion error.
- 3:
-
A timeout error occurred.
- 9:
-
The command could not be executed because there are no administrator privileges (in Windows).
Notes
-
When you specify a server name in the command arguments, you must specify it immediately after the command name. You can specify the other arguments in any order as long as they are subsequent to the server name (or subsequent to the command name if the server name is omitted). However, you cannot switch the sequence of an option name and its corresponding value (for example, you cannot specify provider-URL -nameserver); also, you cannot specify an option name in conjunction with a non-corresponding value (for example, you cannot specify -name server-name).
-
When you specify a server name in the command arguments, you must specify a case-sensitive character string that matches a server name specified in a cjsetup (set up or unsetup J2EE server).