Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

business logic and ejb

 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session bean and entity bean can be used to handle business logic,
what situations will we use a Stateful Session Bean to handle business logic ?
what situations stateless session bean?
what situations entity bean?
please help to clear them
[ February 08, 2003: Message edited by: Timber Lee ]
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


what situations will we use a Stateful Session Bean to handle business logic ?


Stateful Session Bean should be used if you need to store a conversional state with the user. The typical scenario is the a shopping cart - the user puts the items into the cart one after the other and check out at the end. The Shopping card Stateful Session Bean stores the items that the user has chosen and encapsulates the business logic of calculating the order price, discounts etc. The main problem of the Stateful Session Beans is that they are more "ressource hungry" than the stateless session beans, since one Stateful Session Bean can serve only one client.

what situations stateless session bean?


Stateless Session Bean can be used if there is no conversional state with the user. One typical usage of the Stateless Session Bean would be a canceling the order: The user enter the order number and clicks on cancel, the code calls "cancel" method on a Stateless Session Bean and passes the order number as a parameter - everything that the bean needs to know about the request from the user must be passed as a parameter. One Stateless Session Bean can serve requests for more than one client which makes them more scalable.

what situations entity bean?


Entity beans should be used only from the stateless or the stateful session beans (one can use them in the presentation tier, but this creates usually a performance bottleneck). Entity beans are optional - their purpose is representing the persistent data, caching and storage manupulation. They should implement the storage logic - the business logic should be encapsulates in the session beans.
 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Dragan Milic:
thanks for your explanation, it is good for us to understanding. stateless bean , stateful bean and entity bean can be used for implementing business logic, as far as implementing business logic, what situation should we use stateless bean ?
what situation stateful bean ?
what situation entity bean ?
 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello !
Consider this very forum.
A "search" is done by anyone without login too. We can use a stateless bean for this. But for posting a message, a state needs to be preserved.. like posting message under which forum, name of forum, which user posting it etc. we will choose a stateful bean here.
A "Message" can be an Entity bean, so can "Forum".
Hope this helps. The above explaination will make more sense to you now. Read it again.
Leena
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic