How is the abstract EJB inheritance stuff currently supposed to work?  The 
results I'm getting aren't exactly what I'd expected, but it could be I've 
just not got the various tags quite right.

I've got an AbstractEntityEJB (implements javax.ejb.EntityBean) with
@ejb:bean name="AbstractEntity" generate="false" type="BMP"
and no other class level tags.  There's implementations of the various EJB 
lifecycle methods, plus a few persistent fields that are included in all our 
database tables due to audit requirements.  No primary key fields specified, 
though.

This class generates home & remote (I'm using EJB 1.1) interfaces, 
dataobject and primary key.  They're much as I expected.  I notice the 
AbstractEntityPK still has two no-argument constructors (this was mentioned 
previously, before the various inheritence changes were done,  but I guess 
it's still a problem).  Other than that, they're okay.

So then I defined ConcreteEntityEJB extends AbstractEntityEJB implements 
javax.ejb.EntityBean (possibly a poor choice of name, since it's still an 
abstract class, but the BMP class won't be).  That has
@ejb:bean name="ConcreteEntity" type="BMP"
and, again, no other class level tags.  This class defines various 
persistent fields (a few of which are also pk fields), but nothing else.

This class also generates home & remote, dataobject and PK, plus a BMP 
class.  However, they don't appear to have taken any notice of the 
inheritance.  I thought the new "component inheritance" meant the 
home/remote/dataobject/pk would extend the respective classes generated from 
AbstractEntityEJB, but they're still derived from EJBObject, EJBHome and 
Object.  The BMP class looks mostly okay.  Its getData is returning an 
AbstractDataObject, though I was slightly surprised to see two setData 
methods (one with each DataObject as argument) rather than a single setData 
that takes an AbstractDataObject as argument then downcasts it to a 
ConcreteDataObject.  Also, because the data object wasn't extending the 
abstract one, the BMP won't compile since it thinks the dataHolder returned 
by getData is an incompatible type.

I've tried a couple of variations on adding other class-level tags (@ejb:pk 
and @ejb:data-object etc.) with different generate="..." settings, but 
haven't found a combination that works.  I suspect I could get it working by 
adding extends="..." parameters in various places, but is that the way it's 
supposed to be done or is there a cleaner way?


Andrew.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to