Hi, I am in a process of learning EJB, taking a practicle example of booking an online ticket, i understand that we can use stateless session bean, to enquire about the flight schedule, and if we select a particular time and flight i want to know is it at this point we establish a statefull session bean because we want customer's details and we pass this information to entity bean(business logic)to process credit card, and save all the information in d/b? Can anyone pls tell me if my way of thinking is wrong anywhere? thank u aziz dhanani
We can still stick with the stateless session bean to complete the reservation process. This is to make the system simpler and more maintainable(from a beginner's perspective). We can always save detail of user's search in a different table, so that we can present his previous searches in case he exits all of a sudden and comes back. I think we don't need to introduce stateful session for these purposes. Kishore.
Aziz, You would use a stateful session bean if you had to store data about the user. However in practice, a stateful session bean is rarely used. It is more common to store data in a HttpSession and use a stateless session bean.
Originally posted by Aziz Dhanani: Thanks Kishore, So can you pls tell me under which circumstances we use statefull session bean??/ Thanks aziz dhanani
Hi, usually when u have a web application is more commom to maintain session state using the web layer(HttpSession), but these days when you have all diferent kinds of clients accessing the same appliction some times if your application is ment to be accessed by different types of clients it's not recommended do session management on the web layer. Thing about a cenario where you want to develop a business logic for a application wich needs state maintance and at the same time a demand for this application is that you're gonna have different clients accessing your business logic as: celular phones, pal tops, web browsers, gui interface for admin pourposes, ..... If you decide to maintain state on the web layer you're problably have to do a session management for each kind of client(this puts you in a maintence headacke if you have to build new features for the application and have to replicate the session management for each client). This would be a good cenario to build your session control using a statefull session bean(some pple emulate session using stateless session bean passing parameters, but this could make your network became really heavy in some situations), and then you build thin clients accessing this layer. Then you would have a one point maintence for the app. Hope you could understand my point(as my english sucks ) regards.
posted 16 years ago
By the way. Statefull session beans running under a good app servers are not that big problem as some pple say(see passivation and activation), and also maybe your employee will have to buy some more memory(not that expensive these days) to hold the workflow but it'll be problably much cheaper(much less maintance and evolution work)to maintain. regards.
We're all out of roofs. But we still have tiny ads: