• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

regarding enterprise beans

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
Can any body give exact scenario where will use stateful and stateless session beans and entity beans and message driven beans,and where we should go for particuler bean.

thanks in advance,
sandya.
 
T sandya
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can any body help on full scenario where we should we use the enterprise beans.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Entity beans - Used when you want to deal with database and want to deal with objects instead of tables and sql queries. An alternative to this would be hibernate.

MDB - asynchronous things you might want to do in your application. Say, whenever a user fills a form and submits it you want to create a file and upload it to some storage space. The submission of the form can simply send a message and continue without having to wait for the actual upload process to complete. The MDB would receive the message and upload the file.

Session beans - We mostly use stateless session beans, these hold the business logic that you want to execute, credit card authorization would be an example. Statefull beans will be used if you want to store state information between calls. A popular example would be the shopping cart bean where you store the items added by the user to the bean instance variables.

Hope this helps.

Arun N
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandya,

Arun has covered most of the things.. I would like to add some more examples to it.

Consider that you own a Online Book Shop, and you need to provide the following functionalities
1) Purchase a book
2) Update the customer's email address
3) Insert/Delete/Query books in the database.
4) Send weekly e-magazines to your subscribed customers

Stateful Session Beans
Functionality 1 is provided by the SFSB. Consider that a customer adds a book in his shopping cart, and then looks for the other books. Then he comes back and checks his shopping cart. If he finds it to be empty, it will be total mess. To avoid these issues, we go for a stateful session beans, which retains the conversational state with the client.

Stateless Session Beans
Functionality 2 is provided by the SLSB. Customer updating the email address is a one time request and it is not required for the bean to remember the client's previous conversation.

Entity Beans
Functionality 3 is provided by the Entity Bean. Entity Beans generally represent a row in database table. It can combine data from mutliple tables, but as of now leave this. You can do the same task with normal JBDC, but you need to look after the transaction management, security and all other stuffs, which your container already provides for the entity beans.

Message Driven Beans
Functionality 4 is provided by the MDB. This is basically an asynchronous communication.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic