ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
Notice that this example only works with these one application servers, but nothing
stops you from using many others. Currently, XDoclet supports Orion, Pramati, IBM
WebSphere, BEA WebLogic, JRun, JBoss, and a few more.
Not every implementation has the best support and the most up to date templates. It is
open source so support will vary. However, it is fairly easy to update existing templates
to work with other vendors.
Macromedia s JRun supports the templates themselves to ease development, that is,
the commercial company supports and updates the XDoclet templates and modules. I
hope this becomes a trend. However, it is fairly easy to modify the templates and
create modules, and there are a lot of examples to look at as a basis.
XDoclet and EJB technology: ejb.finder
To define the
finder
method for the Entity bean, you just add the
ejb.finder
tag at
the class level to identify the
finder
method signature with its EJB QL query as
follows:
/**
*
* @ejb.finder
*
signature="Dept findByDeptName(java.lang.String name)"
*
unchecked="true"
*
query="SELECT OBJECT(dept) FROM Dept dept where dept.name = ?1"
*
result type mapping="Local"
*
* @ejb.finder
*
signature="Collection findAll()"
*
unchecked="true"
*
query="SELECT OBJECT(dept) FROM Dept dept"
*
result type mapping="Local"
*
*/
public abstract class DeptBean implements EntityBean {
This will define two
finder
methods in the generated home as well as
element definitions in the EJB deployment descriptor as follows:
/*
Page 32 of 49
Enhance J2EE component reuse with XDoclets
footer
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