Hello guys
I have the following problem regarding session bean inheritance and
XDoclet:
First thing is the home interfaces. Say I have a session bean FooEJB,
which is subclassed by BarEJB. The home interface for FooEJB should be
something like:
public interface FooHome extends javax.ejb.EJBHome{// JNDI names and
create method }
which XDoclet does fine. The interface for BarEJB is generated like:
public interface FooHome extends FooEJB {// JNDI names and create method
}
which will result is a compilation error, as the return type of the
create method of the interface is incompatible with the extended
interface. The home interface of the EJB subclass should therefore
extend EJBHome. I currently get around this by using a replace task in
ant, but I have to add new lines for each subclass.
Next thing is about the business interfaces. Say FooEJB has two methods,
a() and b(), while the subclass BarEJB overrides a(), and adds a c()
method. The business interface for FooEJB will correctly exposes the a
and b methods, while the business interface for BarEJB, which correctly
extends the business interface of FooEJB, exposes all three methods (a,
b and c). One would think that there is no need to override all methods
in the subclass interface, but on the other hand it really does not
matter, as the code is generated. The problem comes when one adds
@ejb.permission tags to the methods. As explained above, XDoclet copies
the methods declared as interface methods in the superclass to the
business interface of the subclass, but the method permissions are not
copied. This, at least on Jboss, causes a SecurityException to be thrown
at runtime when one tries to access the method, as no permissions are
assigned. One would think that XDoclet should handle these permissions
in the same way as the interface tags are handled, that is copy the
permissions from the superclass if they are not overridden.
In an effort to solve this problem, I upgraded from 1.2.1 to 1.2.2, but
this only made matters worse. Now no <method-permission> tags in the
assembly descriptor are generated at all, but the interfaces are the
same. This makes no sense to me, has anyone experienced similar
problems?
I realize that most of this can be changed quite easily in the relevant
templates of the EJB module, but unless I have misunderstood something,
the current behavior is not correct and should be corrected in future
releases. I will hack the templates of 1.2.1 in the meanwhile.
Any help or comments are greatly appreciated.
Regards
Trygve
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user