• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Use of Stateful Session Bean for Shopping Cart

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm going to use a SFSB for Shopping Cart. I've read a lot o posts regarding this approach e the most part of them indicates this order:

client -> SLSB -> SFSB

The client (client application or Web application) calls a SLSB in order to perform operations in the Shopping Cart.


My doubt is if it would be a good approach to mix these two things:

client -> SLSB -> SFSB (for confirming, pricing, etc...)
client -> SFSB (just to set the selected Flights and Segments into the Shopping Cart)


Any comments?


Thanks in advance.
Samuel
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Here's what i think:

Originally posted by Samuel Pessorrusso:

My doubt is if it would be a good approach to mix these two things:

client -> SLSB -> SFSB (for confirming, pricing, etc...)


It should be good as long as you have a mechanism in place that allows to access the same SFSB instance through the stateless bean. But isn't confirming and pricing stateless operations. Why you would want to involve a stateful session bean for that. Is there a need to go to the cart to perform stateless operations on it. why can't your form bean objects (POJO objects that correspond to entities) go directly to stateles session beans for stateless operartions.

Originally posted by Samuel Pessorrusso:


client -> SFSB (just to set the selected Flights and Segments into the Shopping Cart)


Think it looks OK, but would still prefer a session facade in front of SFSB.

Thanks,
Jatin
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You just need to pass the Handle for the approach:
Client -> SLSB -> SFSB

In this way the SLSB becomes a Facade for the ShoppingCart and the services related to Itinerary management.
[ July 27, 2006: Message edited by: Samuel Pessorrusso ]
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my two cents ..

Client -> BusinessDelegate -> SFSB -> AppService (SLSB) -> Entity ->DAO
or
Client -> BusinessDelegate -> SFSB -> AppService (SLSB) -> DAO
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Samuel
Why can't you just have
Client -->SLSB (for searching flights, getting price etc) and
Client ---> SFSB(for creating itinerary)
A session bean method acts as a business method of a workflow and I don't see any additional benefit in wrapping it up with SLSB.
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Why can't you just have
Client -->SLSB (for searching flights, getting price etc) and
Client ---> SFSB(for creating itinerary)
A session bean method acts as a business method of a workflow and I don't see any additional benefit in wrapping it up with SLSB.



We can reduce the number of remote calls.
Example:

Client select Flights calling the SLSB; the SLSB sets the Flights in the SFSB; SLSB executes price use case which returns the priced itinerary; SLSB updates the SFSB; SLSB starts the search for the alternative flights and returns the alternative Flights to the client;

If you notice, the client has made just ONE remote call and the SLSB update the SFSB, execute the price use case and execute the search for alternative flights. The SLSB is really working as a Facade.

Am I doing something wrong?
Any comment?
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
------------------------------
Client select Flights calling the SLSB; the SLSB sets the Flights in the SFSB; SLSB executes price use case which returns the priced itinerary; SLSB updates the SFSB; SLSB starts the search for the alternative flights and returns the alternative Flights to the client;

If you notice, the client has made just ONE remote call and the SLSB update the SFSB, execute the price use case and execute the search for alternative flights. The SLSB is really working as a Facade.
------------------------------

If we use the SLSB to manage the shopping cart session bean, then how shoppingcart session bean reference will be maintained in SLSB across multiple method calls such as search flight, price, alternative flight. So I would feel that following approach will be best option,
client --> Facade SFSB --> Shoppingcard SFSB.

Any comments.
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sarbur sar:
------------------------------
If we use the SLSB to manage the shopping cart session bean, then how shoppingcart session bean reference will be maintained in SLSB across multiple method calls such as search flight, price, alternative flight.



As I said before, the caller (web or client application), gives to the SLSB the SFSB Handle (the Handle is stored at the user session which is located at the caller application).

Any comments?
 
Vinay Singh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Samuel you are right.I would have a SLSB as facade not SFSB and the approach what you have mentioned looks fine.
But I think session storage would start when the customer would finally select the flights, just before seat look up.
But with what we have discussed hierarchy would be
client -> SLSB -> SFSB
And you should not use this
client -> SFSB.
Every call would go to SLSB , when ever there is need to store session, call SFSB.
[ July 28, 2006: Message edited by: Vinays Singh ]
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer. I agree with you; that is what I was thinking.


Best regards
Samuel
 
Sarbur sar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
-------------------------------
As I said before, the caller (web or client application), gives to the SLSB the SFSB Handle (the Handle is stored at the user session which is located at the caller application).
--------------------------------
I understand your approach. SFSB bean first will be created in SLSB, but still this handle of SFSB will stored in client side(web-tire/application client tier). Is it really required to pass handle to SLSB each request or we can maintain the SFSB from client side itself by using remote call.

Instead of sending the handle each request, why dont we use the Stateful session bean to hold the reference of ShoppingCartSessionBean. I believe that Petstore uses the SFSB Facade to keep reference shoppingcart session bean.

Any comments..
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sarbur sar:
-------------------------------
Instead of sending the handle each request, why dont we use the Stateful session bean to hold the reference of ShoppingCartSessionBean. I believe that Petstore uses the SFSB Facade to keep reference shoppingcart session bean.



I have already thought about that, but I don�t like the idea of using a SFSB for services instead of using it just to maintain the Shopping Cart; but that�s is MY opinion, you can do whatever you want, there are a lot of ways of doing the same thing (you just need to justify).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic