Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
Section 4. Step by step EJB technology example
XDoclet and EJB technology
I started using XDoclet because of EJB technology. It allowed me to port my EJB
components to many J2EE application servers. This is especially important with CMP
as XDoclet generates vendor specific mappings for CMP/CMR to RDBMS. I had my
own EJB code generator written in Jython but my cohort, Erik Hatcher, kept telling me
how great XDoclet was until I finally broke down and tried it.
XDoclet does more than just facilitate porting of EJB components, it also makes EJB
development much easier. How so? Now instead of having 5 or more files for a single
EJB component, you only have one source file to work with. This will make an XDoclet
fan out of any EJB developer.
Think about it. Now instead of maintaining a primary key class, local, and remote
interfaces, local and remote homes, value classes, deployment descriptors, multiple
vendor specific deployment descriptors, and more; I just have one file to maintain. I just
use JavaDoc tags to markup my implementation class and XDoclet takes care of the
rest. This is more than cool. This makes EJB technology easier to use. This helps fulfill
the vision of component architecture.
Some vendors have started supporting XDoclet as part of their tools that ship with the
J2EE application server (JRun). Hopefully this will be a trend. I d love to see IBM and
BEA ship their products with XDoclet support. Currently the vendor specific XDoclet
templates lag behind the release a few months. Don t bother asking for them sooner.
The XDoclet developers will tell you to implement them yourselves. XDoclet is open
source in case you forgot. Actually the templates are pretty easy to modify, perhaps in
a follow up tutorial, I will add CMP/CMR support to some vendors product.
Note if you are an EJB neophyte, there are plenty of resources listed in the resource
section to help you understand this section better. However, this section does assume
some prior experience with EJB technology.
XDoclet is nice for Servlets, really nice for Custom Tags and just about essential for
EJB technology. I ll cover how to use XDoclet with EJB with another step by step
example.
XDoclet and EJB technology continued
Let s define two CMP entity beans (Dept and Employee) that have a one to many
relationship (Dept has many Employees) and a Session bean (HRSystem) that can
Enhance J2EE component reuse with XDoclets
Page 27 of 49






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

j2ee web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved