Now that is a comprehensive, clear and cogent response! I'm humbled by my newbieness :-) thanks very much Andrew. You really are the wise old hermit! Brian
----- Original Message ----- From: "Andrew Stevens" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 23, 2003 12:56 AM Subject: Re: [Xdoclet-user] session bean abstract class > A wise old hermit known only as Brian McSweeney > <[EMAIL PROTECTED]> once said: > > > but some of the beans - eg the session beans - in xpetstore have the > > ejbCreates generated for them, but the entity beans don't seem to have > > this done. What I think needs to be clear, is what defines this > > behaviour in xdoclet. > > The EJB spec :-) > > > Is it just as simple as: > > > > xdoclet generates defaul creates, ejbCreates etc for session beans but > > not for entity beans? > > Stateless session beans *must have* (only) a single no-argument ejbCreate > method. Because the spec mandates this, XDoclet will add it automatically > if there isn't one. Obviously (!), create methods with arguments are a > no-no, since passing in information implies some form of state and the > bean is stateless... > > Stateful session beans don't *have* to have a no-arg ejbCreate, so long as > there's at least one create method. It's okay to just have create methods > with arguments, so we can't automatically add a no-arg one in case you > actually intend there not to be one. Up till EJB 1.1 I guess we *could* > have checked that there's at least one ejbCreate method in there, and add > a no-arg one if not, but since EJB 2.0 they don't even need to be named > ejbCreate, just begin with it e.g. ejbCreateUsingMyData(MyData x) is okay. > So having the template check <XDtMethod:ifDoesntHaveMethod > name="ejbCreate"> won't work any more... > > With entity beans, you *don't have* to have *any* ejbCreate methods at > all; entity beans are representations of persistent data, and it's > perfectly okay to have that data created solely through some external > mechanism e.g. pre-loading tables of standing data (you can still access > it through EJBs via their finders). Since it's valid to have no create > methods, XDoclet won't add any. However, the spec does say there must be > a corresponding ejbPostCreate method for each create method, so XDoclet > will add those if you don't include them. > > Can't remember offhand about MessageDrivenBeans (not used them much > myself). Since they're basically stateless beans that respond to message > events, I'd guess the same applies as stateless session EJBs i.e. must > have only a no-arg ejbCreate. But we don't generate a subclass for them > anyway, so it's a moot point. > > > Andrew. > > > ------------------------------------------------------- > This SF.net email is sponsored by: Scholarships for Techies! > Can't afford IT training? All 2003 ictp students receive scholarships. > Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. > www.ictp.com/training/sourceforge.asp > _______________________________________________ > Xdoclet-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
