Chapter 14 Working with Java
Understanding EJB source and persistence
You generate persistence management methods based on the object language. Depending if the EJB is of a CMP or BMP type, the deployment descriptor file appears different:
- A CMP involves the application server. It includes the EJB and the O/R mapping descriptor (.XML). The server retrieves both EJB and O/R mapping descriptor to generate the code
If the application server does not support an O/R Mapping descriptor, the mapping must be done manually. If the O/R mapping descriptor of your application server is not supported yet, you can create your own by creating a new extended model definition.
For more information on creating an extended model definition, see section Creating an extended model definition, in chapter Extended Model Definitions Reference Guide, in the Advanced User Documentation
.
- A BMP involves a manual process. It includes the EJB source, without any O/R mapping descriptor (O/R mapping is not necessary). The BMP developer should implement the persistence management him/herself by implementing the ejbStore(), and ejbLoad() methods, the application server only supports its functions. An implementation class inherits from the BMP Bean class, handles persistence data and communicates with the database
- You can also define an EJB as CMP, then generate it as BMP when generating the code. The code generator generates an implementation class (sub-class) for the Bean class that contains its methods, and uses an O/R mapping and a persistent template to implement the persistence
For more information on defining O/R mapping, see section Defining O/R mapping, in chapter Working with Object-Oriented Models.
You can use different methods to generate an EJB CMP into an EJB BMP. You can either copy the Java object language delivered in PowerDesigner as a reference to a new object language, and describe how to generate implementation classes of the EJB CMP in your own object language, or you can create an extended model definition that includes these implementation classes.
You could also write a VB script to convert the EJB CMP into an EJB BMP. To do this, you must generate the EJB as CMP, then launch the VB script that will go through all objects of the model and generate an implementation class for each identified class.
Copyright (C) 2005. Sybase Inc. All rights reserved.
|
|