S A M P L E P R O J E C T
The EJB container of an application server also provides some services to the EJB like
transactions, security or persistence which the programmer / deployer can choose to use or
not. When we choose to use the container service we speak of Container Managed (CM)
otherwise of Bean Managed (BM). The container managed service is normally not as
powerful as the bean managed service but is defined in the deployment descriptor which
makes it much more flexible to adjust to another environment. For example the container
managed persistence allows the programmer to specify a list of persistent attributes which
the deployer can map at deployment to the table attributes in the target database. This
means that the same EJB with CMP can work on different tables and / or different
databases without any changes in the EJB.
Some of the classes and deployment descriptors contain redundant definitions. Writing this
files can take much time to create and to maintain and is pretty error prone. There are some
code generation tools available to help you. Some are based on database structures, is taking
XML input and other are code based. One of the free tools is XDoclet, which uses JavaDoc to
define additional information and to generate the additional files. This means that the
information is kept centralized in the EJB class. So no need to manage home and remote
interface classes, deployment descriptors, primary keys etc. and they can be regenerated
when necessary.
XDoclet normally only needs one file, the EJB implementation, and generates all the other
necessary files to deploy an EJB. The generated files are:
EJB and vendor (JBoss, WebLogic, WebSphere, Orion) specific deployment
descriptors
Home and Remote Interface
Primary Key Class for Entity Beans
Bulk Data Object (also know as Value Object)
EJB Wrapper classes
If necessary you can stop the generation of any of these files, you can change the output
generated and you can add additional code / description as predefined merge points.
Web and Other Clients
The best EJBs and resources are worthless if there is no client using it. In J2EE we have
two types of client, the web client is a composition of servlets and JSPs, which are in the end
servlets as well, and other clients running outside of the application server. The separation
is important because web clients can take advantage of running inside the application server
27
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved