On Mon, 2005-01-10 at 16:03, Konstantin Priblouda wrote:
> --- Juleni <[EMAIL PROTECTED]> wrote:
> 
> > Hello ,
> > 
> >    Is there possible to use XDoclet and its
> > @ejb:tags without
> > implementing of the javax.ejb.SessionBean in the
> > class?
> 
> It's difficult. You need either javax.ejb.SessionBean
> on classpath, or need to implement it with FQCN
> specification - or xdoclet will be unable to determine
> 
> that this class is to be processed. 

To add to what Konstantin said...

Since there's not much point using the @ejb.* tags unless it's an EJB, I
wonder why you would want to not implement SessionBean in the first
place.  I suspect it's because you don't want to have to write code for
all the lifecycle methods (ejbActivate, ejbPassivate, etc.) but are
getting compiler errors if you don't?

However, it is possible to declare the class as "implements SessionBean"
without actually implementing all of that interface's methods, so long
as you remember to also declare the class as abstract.  You can still
include non-abstract methods in an abstract class.  So, you could use

/** @ejb.bean name="Example" type="Stateless" */
public abstract class ExampleBean implements SessionBean
{
  /** @ejb.interface-method */
  public String doSomething() { return ""; }
}

(plus a whole bunch more @tag parameters as required) and everything
should work out okay.  XDoclet can determine that it's a session bean
(because it implements SessionBean) and will add the mandatory lifecycle
methods in its ExampleSession subclass, including a call to
super.ejbWhatever() if they're present in your ExampleBean class.  So
your bean class need only include your business logic, and as many or
few of the lifecycle methods as you actually want to contain some
specific code of your own.


Andrew.
-- 



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to