Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
ejb.DeptHome
ejb.Dept
...
XDoclet and EJB technology: ejb.persistence tag
There is no standard
OR
mapping defined by the EJB specification. But most
application servers that implement EJB CMP CMR use a similar strategy, that is,
mapping Entities to classes and fields to columns. The DeptBean EJB component is
going to be mapped to a table called
TBL_USER
.
In older versions of XDoclet, every vendor implementation had their own support for
EJB CMP CMR, yet they all seemed to pick different tags names for doing the same
thing. The newer version of XDoclet defined a tag called
ejb.persistence
to specify
the table name that the entity maps to.
I noticed the Resin XDoclet templates did not support the new
ejb.persistence
tag
yet. I added the support but the new template was not committed into the project yet. It
was actually really easy to modify the template to add the support for the new tag.
Here is the code to map the database table to the entity using the vendor specific
Resin mapping, and the vendor neutral way. Currently not all vendor products are
supported by the new tags. The vendor specific mapping tag is not needed if the
templates for the vendor were updated to support ejb.persistence.
/**...
* @resin ejb.entity bean
sql table="DEPT"
* @ejb.persistence
table name="TBL_USER"
*
...
*/
public abstract class DeptBean implements EntityBean {
The above tags generates the following in the vendor specific mapping files. Resin is
shown as an example.
DeptBean
DEPT
...
Enhance J2EE component reuse with XDoclets
Page 31 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