Forums Register Login

regarding enterprise beans

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
can any body help on full scenario where we should we use the enterprise beans.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 621 times.
Similar Threads
Stateful session beans or Stateless combined with entity beans
tough questions on beans and others
Head First EJB - errata?
tracking ORA errors.
EJB
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 05:23:11.