• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful session bean in session?

 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Clinet needs to have reference to stateful session bean.It can not be behind session facade as it is SLSB.

So do we need to store SFSB reference in HTTPSession so as not to have it in client?
Petstore talks of

"The Web tier maintains a reference to the EJB-tier controller in an HttpSession attribute."

EJB-Tier controller is SFSB.
 
H. Hafer
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the reason a rich client shouldn't connect to a SFSB over a session facade?

thanks for help,
Harbo
 
James Wang
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same question, if a stateful session bean is used in the system, then it must be in front of the session facade. So the web client probable save the remote or local interface in HttpSession. but for the swing client, the component of the stateful session bean must also be saved in somewhere of the swing client. Is it right?
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was looking at session facade pattern and it is said that it can be SFSB or SLSB depending on the methods of the facade ( whether methods need to maintain states).
If it's SLSB we would not need to keep reference.
If it's SFSB, we would need a reference to be kept on client( business delegate pattern talks of caching reference to service i.e. session facade)

I have one question though. Do we have instances of BD's for each session then?
If BD is simple java class, how do we achieve this?Where are BD's hold?

Can some expert help?
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Business Delegate pattern is useful only with SLSB.
With SFSB, web tier ( or client tier for that matter) would need to store reference and if we use BD, we would have to pass that reference. So it would add layer still but there would not be any decoupling.
 
James Wang
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D. Rose

I think the web tier and swing app tier should use the different reference policy, you may store the SFSB in HttpSession of web tier, and store it in somewhere except business delegate and service locator in swing app. Am I wrong, if I make a mistake, please correct me? thanks.
[ August 30, 2004: Message edited by: James Wang ]
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,

I referred to Business Delegate pattern description again.
They talked to storing the session bean handle in web session and passing it to BD constructor next time around ( in swing client it would be in some variable may be).
So I think what you say is correct.
My only point is that then BD does not totally isolate client from implementations ( in case of SFSB).
 
James Wang
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I referred to Business Delegate pattern description again.
They talked to storing the session bean handle in web session and passing it to BD constructor next time around ( in swing client it would be in some variable may be).
So I think what you say is correct.
My only point is that then BD does not totally isolate client from implementations ( in case of SFSB).


I see what you say, you may define a variable of Map type in business delegate object. the key of the map is the username and value of it is the SFSB, if so, the presention of the web tier or swing app will be isolated from implemention tier, is it right? If I am wrong, please correct me, thanks.
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,

We would not need a map.
In case of web client, HTTPSession will always be for single user. So just store handle there and pass it to BD constructor.
In Swing client, it will be only single session anyway so just an application variable would do.
What I meant was that client needs to hold a reference and pass it to BD so client is not totally isolated.
 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by D. Rose:
James,

We would not need a map.
In case of web client, HTTPSession will always be for single user. So just store handle there and pass it to BD constructor.
In Swing client, it will be only single session anyway so just an application variable would do.
What I meant was that client needs to hold a reference and pass it to BD so client is not totally isolated.


The client in this case is the web tier. right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic