130 Chapter 6 EJB Container/Server EJB Object 1 (Tomcat web server)

130 Chapter 6 EJB Container/Server EJB Object 1 (John Smith’s Bank Account) Client 1 John Smith Client 2 Mary Jane Client 3 Bob Hall Remote Interface Remote Interface Remote Interface Entity Bean Instances Bean Pool EJB Object 2 (Mary Jane’s Bank Account) EJB Object 3 (Bob Hall’s Bank Account) The EJB container can dynamically assign entity bean instances to represent different data. Figure 6.4 EJB container pooling of entity beans. ejbPassivate() is the callback that your container will invoke when transitioning your bean into a generic instance pool. This process is called passivation, and it indicates that the container is disassociating your bean from a specific EJB object and a specific primary key. Your bean s ejbPassivate() method should release resources, such as sockets, that your bean acquired during ejbActivate(). When an entity bean instance is passivated, it must not only release held resources but also save its state to the underlying storage; that way, the storage is updated to the latest entity bean instance state. To save the instance s fields to the database, the container invokes the entity bean s ejbStore() method prior to passivation. Similarly, when the entity bean instance is activated, it must not only acquire any resources it needs but also load the most recent data from the database. To load data into the bean instance, the container invokes the entity bean s ejbLoad() method after activation. This is shown in Figure 6.5.
Are you tired of finding web hosting providers listed as inexpensive?Just check our Inexpensive Web Hosting services.

Leave a Reply