Enterprise Java Beans roles and types: part 3 of 4  

A common application of session beans is to manage database transactions. A session bean can execute database reads and writes for the client. A session bean's fields contain the state of the conversation and are transient. This fits transactions well since transactions either must be committed or rolled back. If either the server or the client becomes unavailable, the session bean is terminated. Session beans can be used to update shared data at a potential cost to scalability and performance. Session bean are optimally used to access its own client’s session information.

An entity bean, represented by an entity in a database, provides access to methods needed utilize that data. As long as the data remains in the database, the entity bean persists. Persistence can be bean managed (BMP) or container managed (CMP). Using entity beans, developers can make the data available to multiple clients simultaneously while minimizing callbacks. Applications can manipulate entity beans as Java object references since entity beans persist and abstract the bean and container services. The use of entity beans can represent a big improvement over the use of stateful session beans. Entity beans manage state better than session beans by way of special callbacks which reduce the number of method calls needed. However, many similar callbacks are available to session beans using the javax.ejb.SessionSynchronization to access transaction status data.

Message-driven beans are used in situations when communication takes place asynchronously. Message beans have no client interfaces. They are message listeners, accessing messages from queues or container subscriptions. When the container receives a message it invokes an iteration of the appropriate message bean. Clients can only access the bean by way of messages sent through Java Message Service and directly. The stateless nature of this communication means that message beans can be pooled in a way that is similar to pooling stateless session beans. As the inbound and outbound messages are Java Message Service messages via JMS Queue.

Home  • MSDN Blog  • Professional Biography  • Personal Biography  • Articles  • Technology  • White Papers  • Downloads  • Contact  • Terms of Use  • Site Map

Channel9  • Spock  • Google  • Programmer's Heaven  •  Variable Markup  • Wuup.de  • Pure  • Net Informations  • San24  • Yahoo Profile  • Excite UK  • Imprese  • NodeWorks  • Travel.com  • Amazon  • Geocities  • T-Links  • SearchBug  • Katalog  • Alexa Search  • Alexa Details  • 15 Seconds  • Blogwise  • Yahoo Profile  • FindArticles  • Julson  • Google Search  • Programmers Heaven author  • Alexa Browse  • MSN  • C9  • Eaton FL  • LinkSpider  • Macopinion  • Italy Link  • DerKeiler  • Programming-X  • CitiBay  • 15S  • Wils Domain  • AdvOL  • Computers Global  • TutorGig  • TGZ  • MV-S  • Deerlake  • mkiwi  • UKFindit • MWTT  • NetInfo • BSC  • WebBozo  • CVCS  • HotLaunch  • Escanaba • Google • FotoPages  • Conk  • InfoBase  • ExciteUK  • Angelfire  • BlogWise  • Canadian Content  • Opera Portal  • oStats  • 411 ASP  •  Interactiva  • Data Mining  • Call Center Forecasting  •  Accounting  • Guitar  • Computers Global  • BIE  • NewsIsFree Alph  • PX Java  • Trexle  • So-Ft  • DMOZ  • Programmer's Heaven Articles  • DotNetKuwait