This document contains best practices when using XDoclet. Note that these are the opinions of the XDoclet team only, so they could be biased.
Add the cacheHomes="true"
parameter to the <utilobject/>
task to have the utility
objects cache the homes (you no longer need an EJBHomeFactory!):
<utilobject cacheHomes="true"/>
Examples how to lookup the home interface using the utility object (it will narrow if needed, and uses the COMP name or JNDI name):
EmployeeManager employeeManager = EmployeeManagerUtil.getHome().create(); Properties jndiEnvProps = ... ; CompanyHome companyHome = CompanyUtil.getLocalHome(jndiEnvProps);
Need an extremely reliable key generator? Add the includeGUID="true"
parameter
to the <utilobject/>
task to have a key generator that features:
<utilobject includeGUID="true"/>
To generate a unique key:
String id = SomeBeanUtil.generateGUID(this);
To avoid getting Sun JavaDoc (JDK 1.4) warnings about unknown tags ("warning - @ejb:interface-method is an unknown tag"), replace the : with a . (JavaDoc will ignore these tags).