see below Doron Somer wrote: > > > One of the things our base class does is some generic conversions in ejbLoad > and ejbSave (to handle persistnece of CORBA object references and alike) and > we may need to provide some generic behavior in the other EntityBean > methods. Typically I don't think the developers using our platform will need > to implement the EntityBean methods themselves, but if they do, we will > require them to invoke first the base class' version of the methods. So for > example an implementation of ejbLoad will look like this: > > super.ejbLoad(); > <additional behavior> > > In the future we can code generate the initial implementation of a bean that > will include extending our base class and a skeleton for this > implementation, to avoid errors in forgetting to make the call to the base > class. > > I'd like to get feedback for this approach, and whether you see any issues > with using CMP this way. > I would favor implementing ejbLoad (etc.) in the superclass using the template method pattern [Gamma p. 325], and specifying that it not be overridden, possibly by making it final. That way you can enforce the usage. If developers need to add behavior, you have provided a "hook" through a protected no-op method that they can override. This will also allow you to move around the hook within the superclass method if you have a need to do something after the subclass, for example.
begin:vcard n:Wilson;Chip tel;fax:(214) 358-0353 tel;work:(214) 642-4559 x-mozilla-html:TRUE url:http://www.axyssolutions.com/ org:Axys Solutions adr:;;;Dallas;TX;; version:2.1 email;internet:[EMAIL PROTECTED] title:Application Architect note:Sun Certified Java Architect x-mozilla-cpt:;-25088 fn:Chip Wilson end:vcard
