What Kind of Generation to Use?

You may face two situations when generating EJB source code:

You want to generate EJB source code when creating a database. If there is no database, the development process is the following:



You want to generate EJB source code for an existing database. If the database already exists, you may want to wrap the existing database into EJBs and use EJBs to access the database.The development process is the following:



You can also use generation of EJB source code when managing persistence of EJBs with an existing database. For example, it may be necessary to manage the persistence of an already defined EJB with an existing database. Since you cannot change the definition of EJB nor the database schema, you need a manual object to relational mapping in this case.

For more information on object mapping, see Object/Relational (O/R) Mapping.