Readme for the AutoWorld example

This example illustrates CMP entity beans built using root/leaf inheritance.  Vehicle is the root enterprise bean from which all of the leaf enterprise beans are derived.  The leaves include RaceCar, Bus and SUV.  In addition, the AutoWorld example includes one-to-many relationships for Garage and MotorVehiclePart, and a custom composer for VapUSPhoneNumber (an entity field of Vehicle).  Finally, finders are employed on all enterprise beans to find all instances of the persistent objects.

Contents

This example includes eight enterprise beans which demonstrate the following relevance: After creating the example project for the AutoWorld example, double-click the AutoWorldEJB module within the EJB Modules of the J2EE Hierarchy view to open it in the EJB Editor. This is the editor where the beans were created and can be edited. In preparation for running the example, export the database tables for AutoWorldEJB , and generate deploy and RMIC code.  Finally, create a WebSphere Test Environment Server where the AutoWorld enterprise beans can be tested using the IBM EJB Test Client.

Restriction: Currently, any EJB mapping that contains more than one table must remove any constraints related to these tables in the database. Without the database constraints turned off, RI ordering problems arise producing RemoteExceptions. Further details about this restriction can be found in the EJB Tooling README under "Ordering problems producing RemoteExceptions".


Running AutoWorld

After creating the AutoWorldExample, follow these steps:

Setting up the database:

If you do not already have the AutoWorld tables in your SAMPLE DB2 database in DB2, then you will need to run the schema Table.ddl file to create the tables:

Enabling JDBC 2.0 on DB2:

If you have not already enabled JDBC 2.0 on DB2 then you will need to run the usejdbc2.bat file.
  1. Stop all DB2 processes.
  2. From a command prompt run the usejdbc2 batch file in <DB2_INSTALL_PATH>\SQLLIB\java12,. where <DB2_INSTALL_PATH>is the path where you installed DB2.
  3. Reboot your system and restart DB2.
Important: If you are denied access when running the usejdbc2.bat file, you have not stopped all of the DB2 processes.

Setting up a server and server configuration:


Modifying the server configuration and adding a data source:


Running on the IBM EJB Test Client:

  1. From the Navigator view, select AutoWorldExample > Run on Server from the pop-up menu.
  2. Click on the JNDI Explorer and expand the autoworld.ejbgroup to find all of the AutoWorld beans.
  3. Click on the beans to see their Home interfaces and then start creating and manipulating the AutoWorld example enterprise beans. You can use tools shipped with your database to verify the persistence of your newly created beans by inspecting the contents of the database tables. For a detailed description of how to use the IBM EJB Test Client, refer to the Server Tools documentation in WebSphere Studio.

Running this example using a DB2 Universal Database for iSeries database:

You can optionally set up the Auto World example to access a database that is running on iSeries.

See Database access using the iSeries for detailed instructions about creating the server configuration, creating the database on the iSeries, creating the new data source for the database, and configuring the data source on the iSeries.


Documentation

For detailed information on the topics illustrated by the AutoWorld example, please refer to documentation provided in the following online help topics:

Limitations

This document assumes that you have DB2 installed and a working SAMPLE database.

Disclaimer:
The following [enclosed] code is sample code created by IBM
Corporation.  This sample code is not part of any standard IBM product
and is provided to you solely for the purpose of assisting you in the
development of your applications.  The code is provided 'AS IS',
without warranty or condition of any kind.  IBM shall not be liable for any damages
arising out of your use of the sample code, even if IBM has been
advised of the possibility of such damages.