It is the EJB container's job to generate an EJBHomeImpl and EJBHomeImpl_Stub (Pls. dont care the class names. These differ, accross containers) during deployment. So, suppose you have an AccountHome, then normally AccountHomeImpl extends both EJBHome and AccountHome. As you might have guessed, it is the EJB container which is giving Implementation for the methods declared in both EJBHome and AccountHome.
Let's say XyzHome is an EJBHome like AccountHome. Then, you can view it as a Factory class. Usually, factories are used to create some specific instances. In EJB scenario, XyzHome would act as a factory, not only to create something, but also to find something already created. Moreover, factories might return specific instances (with identity), but usually when the code inside a factory is executed, it is not being executed in the context of any particular instance. What this means here is, an XyzHome might return Xyz, but the code inside XyzHome is not being tied to Xyz. This can be understood if you look into create and finder methods. All of them would return a single instance or a collection of instances of Xyz, but the code inside create or finder methods (which again is implemented by EJB container) are not tied to any specific instance of Xyz, until and unless Xyz is finally created or found (the moment Xyz is created or found, the code inside XyzHome doesn't have any more job; just return). In normal POJO scenario, we can view XyzHome methods similar to static methods in a POJO class.Old procedural like code is usually written as static methods in POJOs. So, if you have 100 Account rows, and if you need to add $ 100 to each account balance (we call them bulk update), we can do them in two ways: a. Use, AccountHome, find each Account, one by one, and credit each Account with $ 100. b. Somehow, do a bulk update in all the rows, adding account balance with $ 100. If we can understand the overhead involved in approach a, then we would prefer approach b. Now the question is wher to put the code for approach b. The best place is to put in a "procedure like placeholder", and it is called homeMethod. so, we can have a method like addBalance() in AccountHome, and give an implementation in AccountCMP like ejbHomeAddBalance(). The queries are left unanswered directly, but answered indirectly. Hope, this will help. Regards Binildas Sr. Tech. Architect, SETLabs (http://www.infosys.com) ----- Original Message ----- From: "Mu Mike" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 24, 2004 7:32 AM Subject: please help about EJBHome > the EJBHome class has four methods defined which my bean implementation > class doesnt need to provide correspoinding implementation methods. But, it > is said my own bean Home Interface must have at least one creat method for > a session bean, and also a findByPrimaryKey method for an entity bean. I > need to know: > > 1. what methods my bean home interface must have? > 2. what kind of methods my bean home can have? > > what is the rule for such behavoirs? > > > Thanks&Regards > Mike > > _________________________________________________________________ > 免费下载 MSN Explorer: http://explorer.msn.com/lccn/ > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff EJB-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".