Forums Register Login

Should I put a BD between Session and Entity Bean?

+Pie Number of slices to send: Send
Hi All,
Please enlighten me on this one; Is it a good idea to put a Business Delegate between a Session Bean and Entity Bean, if I do not know whether the entity is local or remote? I believe the Session Bean(a Session Facade) is a client as far as EB is concerned and there should be a BD inbetween just like between a Servlet Client and Session Facade.
One can say that try the to contact the Entity locally first and if not available then contact it in the catch block remotely but the same can be done in BD with a service locator to find the entity home.
Please respond.
+Pie Number of slices to send: Send
Hi,

Business Delegate is used to help the application developer to not worry about the complex specification of EJBs. For example, look up the remote/local interface using the Home object, etc, and catch those ejb exceptions.

As a result, it is normally used in servlet or jsp to access an EJB.

Therefore, using business delegate in session bean to access an entity bean won't really fit the definition of business delegate. When you use a session bean to access an Entity bean, this is called a Session Facade. In other words, how you make calls to an entity bean in your session bean really depends on you. And usually this helper is called the service activator but never business delegate.
[ June 07, 2005: Message edited by: Jeremy Hsu ]
+Pie Number of slices to send: Send
Hi Rahul,

I totally agree with Jeremy.

In my architecture BD is used by a controller object that is part of the client side and not part of the server side.

Lucy
+Pie Number of slices to send: Send
Hi guys,
Thanks for your replies.
Well, the essence of my question was how do we cache Entity Home Objects, without knowing whether they are remote or local, so that we can get some performance benefits. There being several ways to do it, like creating a home object in the ejbCreate of the Session Facade and having a global reference to the same or using a helper class, as mentioned by Jeremy, which gives us cahced homes. I wanted to find out the best approach for the same.
What do you guys think is the best approach?
+Pie Number of slices to send: Send
Hi,
Rahul Devgan

Take a look at Service Locator J2ee pattern. I believe that is what you want. A service locator pattern basically locates objects placed on the JNDI. As a result, you can put all your cached code there.

and since I am in a good mood today. I find the link for you to study:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html
[ June 08, 2005: Message edited by: Jeremy Hsu ]
[ June 08, 2005: Message edited by: Jeremy Hsu ]
+Pie Number of slices to send: Send
By the way, just something came to my mind about you talking about caching the Home for the entity bean.

Hmm, let me put this way. Caching should be used to reduce network calls. Since you talking about caching the home objects for the entity bean, I feel you are thinking the possiblity of using remote interface for entity bean. OK. This is very scary because you talking about very bad J2EE practice here (using remote interface for entity bean). I know before ejb 2.0, there is no way to specify local interface for entity bean, as a result, talking about caching the home for entity bean is fine. However, with ejb 2.0 or later, we are now provided with local interface, so this is why so many people talking about wrapping your entity bean with your session beans. If you are doing this, caching the local home for you entity bean services very little purpose because accessing a local home object is just making in memory JNDI calls, and This is very quick. Caching this in memory will not boost too much performance in this case. However, if you do this on your web client side (caching remote home for your session beans), this will boost a lot of performance because you are reducing the network calls in this case.
+Pie Number of slices to send: Send
On the main SCEA page, I can see 5 replies to my topic but when i click the link to this topic, I can only see my original message and none of the replies.
i was able to view the 2 replies about 2 days ago.
+Pie Number of slices to send: Send
Hi,
After I posted my last reply I was able to see the replies to my original message.
Thanks Jeremy for your inputs. I am aware of the Service Locator Pattern and local and remote interfaces of EJB. However, I just wanted to clear a few confusions creeping into my mind and see what other have to say about them. Also, the SCEA is based on EJB1.1, J2EE 1.2, so am not sure if we can use local interfaces in our designs. Any clarifications on this.
+Pie Number of slices to send: Send
well, I pretty sure if you make this clear in your assumption. I think you will be fine.
+Pie Number of slices to send: Send
Hi Rahul

Based on what I've read in this forum, most agree that the design patterns and general architectural concepts applied in part 2 are not bound to a specific version of J2EE. As well, the assignment instructions make no reference to a particular J2EE version.
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 883 times.
Similar Threads
BD-SLSB-SFSB
BD and SL Design Patterns discussion
mock question: design pattern
Is it possible that servlet uses local interface of EJB2.0?
General Architect Question
Do we need different Implementation of Business Delegate ?
Few queries on Design Principles
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:48:31.