-
1. Re: Container Factory error with business methods
armint Feb 21, 2002 12:23 PM (in response to cdshearer)2. It seems odd that this sort of method goes on the home interface but gets implemented on the Bean. Why should the bean implement a method that doesn't actually apply to the bean data? It would seem that a better place to put this code would be on a Session Bean.
It can seem odd if you only think of entity beans as discrete instances with identity (i.e primary keys.) However, entity beans are also components encapsulating all the data associated with its particular instances, sort of a box with lot's of pieces inside. Generally in OO methodology, it is a good idea to have an object operate on its own data. Having another object, do so breaks encapsulation. This is the motivation of creating a home method, to have the component work on its own data. It's a bit strange at first that the home method is implemented in the bean implementation class because most of the class is designed to hold persistent fields and a primary key. Still, the method must be implemented somewhere and it cannot be in the home interface.