Datamal Blog

Thursday, September 09, 2004

XDoclet and EJB's

It's good practice to put interfaces (such as remote/local interfaces, data objects and home interfaces) in a separate "interfaces" package rather than in the EJB bean implementation package.

Previous versions of XDoclet dictated this behavior, so if the package name of a bean ended with *.beans or *.ejb then the interfaces were put into the * .interfaces package. Now you have full control over it.

If you don't use a packageSubstitution element, then all interfaces are generated to the same package as the bean implementation class. But if you want to follow the pattern and put interfaces into a separate package you can, by providing the list of package name tails that interfaces of beans inside that packages should be placed into.

For example interfaces of test.ejb.CustomerBean will be placed in test.interfaces by the following packageSubstitution:

     

All this is available inside MyEclipse/Xdoclet.