Forums Register Login

Stateful Session Bean

+Pie Number of slices to send: Send
Hi,

In normal shopping cart scenario,i have the below flow.

Servlet->SLSB Facade(Remote) -->SFSB Shopping Cart(Local)

How do I get the handle for SFBS shopping cart stored in my HttpSession given that local interfaces don't have getHandle method .


Thanks.
+Pie Number of slices to send: Send
Why do you need the Handle of SFSB when it is accessed throught the SLSB.You could just store the reference to SFSB in SLSB.
+Pie Number of slices to send: Send
Thanks Pradip.

Do you mean I should store SFSB as an instance variable in SLSB?
If yes , then how do I make sure that each httpsession in web gets a reference to its own SFSB since SLSB will not distinguish between clients?
+Pie Number of slices to send: Send
 

Originally posted by Ajai Sandhu:
Thanks Pradip.

Do you mean I should store SFSB as an instance variable in SLSB?
If yes , then how do I make sure that each httpsession in web gets a reference to its own SFSB since SLSB will not distinguish between clients?



I understand your problem now. You should make the facade as stateful as explained in Session facade design pattern.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html
+Pie Number of slices to send: Send
Hi Ajai Sandhu,
I think that you are very clear about Handle right ? Getting the handle in the sense your SFSB will return duplicate copies of remote objects there by your clinet should be use your remote object only.
In EJBHome interface there is one function called
getHomeHabdle() it returns HomeHandle(It's also an interface).
Hope that your Doubt is cleared.
Regards,
G Sirish Reddy.,
+Pie Number of slices to send: Send
 

Originally posted by G Sirish Reddy:
Hi Ajai Sandhu,
I think that you are very clear about Handle right ? Getting the handle in the sense your SFSB will return duplicate copies of remote objects there by your clinet should be use your remote object only.
In EJBHome interface there is one function called
getHomeHabdle() it returns HomeHandle(It's also an interface).
Hope that your Doubt is cleared.
Regards,
G Sirish Reddy.,




How is getting the Homehandle useful in the above case?
+Pie Number of slices to send: Send
Hi Pradip Bhat,
How is getting the Homehandle useful in the above case?
A)First it decrese the no.or Network calls.
* as soon as you obtaining the remote object you are passing that remote object reference to your clients also for to use the same resource which is used by you on the server.this graduvally decrease the Network calls.
If possible plz go thru Mastering EJB by EDRoman.
Thanks,
G Sirish Reddy.,
+Pie Number of slices to send: Send
 

Originally posted by G Sirish Reddy:
Hi Pradip Bhat,
How is getting the Homehandle useful in the above case?
A)First it decrese the no.or Network calls.
* as soon as you obtaining the remote object you are passing that remote object reference to your clients also for to use the same resource which is used by you on the server.this graduvally decrease the Network calls.
If possible plz go thru Mastering EJB by EDRoman.
Thanks,
G Sirish Reddy.,




G Sirish Reddy

Home objects are stateless.
+Pie Number of slices to send: Send
Hi Pradip,

I posted the que since I read somewhere that SFSB was used behind SLSB facade for shopping case scenario.I feel the only way to get the SFSB handle and save it in session would be to use SFSB(remote) benind SLSB facade .Am I right?


Thanks
+Pie Number of slices to send: Send
 

Originally posted by Ajai Sandhu:
Hi Pradip,

I posted the que since I read somewhere that SFSB was used behind SLSB facade for shopping case scenario.I feel the only way to get the SFSB handle and save it in session would be to use SFSB(remote) benind SLSB facade .Am I right?


Thanks



I dont where you read this but their example may be different. Why session are you talking about - http session ? If you use a SLSB facade then how will you ever use the handle ?
+Pie Number of slices to send: Send
I am curious to know what else does your Facade class do apart from talking to SFSB?
+Pie Number of slices to send: Send
Thanks for interest .

I dont where you read this but their example may be different. Why session are you talking about - http session ?
If you use a SLSB facade then how will you ever use the handle ?




I read about this example in a forum in javaranch, I could not find it again ,but It might just be somebody's view which I was trying to understand.
I am talking about HTTPSession.

If we get a handle for remote SFSB and return it to servlet through SLSB facade and store the SFSB handle in httpSession.
Of course we might as well use SFSB as facade itself rather than going through SLSB.

I am curious to know what else does your Facade class do apart from talking to SFSB?



Ok,SLSB facade might be doing all other normal stuff like connecting to entity beans etc. apart
from getting and providing the handle to Servlet.Take the example of a typical on line shopping case where only shopping cart is an SFSB whereas other beans can be SLSB or entity.In this scenaio i was thinking of providing only one SLSB as facade with SFSB behind it
or use two facades
one SFSB and other SLSB

thanks.
+Pie Number of slices to send: Send
 

If we get a handle for remote SFSB and return it to servlet through SLSB facade and store the SFSB handle in httpSession.
Of course we might as well use SFSB as facade itself rather than going through SLSB.



One of pupose of Session facade is to hide the client from the business objects (SFSB in your example) and if you are returning the handle to the servlet, the servlet is exposed to SFSB interface, isn't. So SFSB facade is the right way.

Evacuate the building! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 879 times.
Similar Threads
Any Solution to Break/Overlook the Session Variables ?
usage of stateful session beans
It's possible insert Classes in Component Diagram ??
Web dev basic features
Local Interfaces and SFSBs
More...

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