We had a situation where we used Session Facade pattern to handle a number of business operations. We had a number of such Session Beans which almost exhibited similar behavior. Following are few example interfaces
CacheEntity getEntity(String pk);
updateEntity(CacheEntity entity);
Vector getAllEntities();
createEntity(CacheEntity entity);
deleteEntity(CacheEntity entity);
There where 15 similar session beans what we did was to put all these methods into one Super Interface and all the session facades just extended this interface. In the Application we did not care much about which Session Bean are we operating on as long as it supported the Super Interface.
Lookup of the Session Beans was also made simple, we had an SessionBeanStore EJB which keeps trace of all the Session Bean and supported an very generic interface getSessionBean(SessionBeanName) which returned an Remote Reference of Session Facade.
So at the end of the day what we need is four line of code to call an update method.
SessionBean company = SessionBeanStore.getSessionBean(“Company”);
CacheEntity company = company.getEntity(companyName);
company.setCEO(“Sachin Gupta”);
company.updateEntity(company);
Also the Implementation of each Session Bean was much simple and straight forward.
-
Super Remote Interface Extended to Session Facade (1 messages)
- Posted by: sachin gupta
- Posted on: August 06 2002 11:43 EDT
Threaded Messages (1)
- Super Remote Interface Extended to Session Facade by Paul Rhoades on August 07 2002 05:46 EDT
-
Super Remote Interface Extended to Session Facade[ Go to top ]
- Posted by: Paul Rhoades
- Posted on: August 07 2002 05:46 EDT
- in response to sachin gupta
This is pretty close to the Data Access Object (DAO) pattern but applied to the business / service layer.
http://www.javaworld.com/javaworld/jw-03-2002/jw-0301-dao.html
P.