Manipulate transactional behavior of EJBs using deployment descriptors

Defining bean cache settings for a bean

Bean cache settings are WebSphere Application Server extensions to the Enterprise JavaBeans specification.

To define bean cache settings for an enterprise bean:

  1. Switch to the J2EE perspective.

  2. In the Project Explorer view, right-click the desired EJB module, and select Open With > Deployment Descriptor Editor from the pop-up menu.

  3. On the Beans page of the editor, select a bean and find the Bean Cache section under the WebSphere Extensions section.

  4. In the Activate at field, select one of the following values to specify the point at which an enterprise bean is activated and placed in the cache:

    Activate at

    • ONCE: Indicates that the bean activates when it is first accessed in the server process, and passivates (and is removed from the cache) at the discretion of the container, for example, when the cache becomes full. If you select to activate at ONCE, then all five of the options listed below are available.

    • ACTIVITY_SESSION: Indicates that the bean activates and passivates as follows: 1) On an ActivitySession boundary, if an ActivitySession context is present on activation, 2) On a transaction boundary, if a transaction context (but no ActivitySession context) is present on activation, or otherwise, 3) on an invocation boundary.

    • TRANSACTION: Indicates that the bean activates at the start of a transaction and passivates (and is removed from the cache) at the end of the transaction.

  5. In the Load at field, select one of the following values to specify when the bean loads its state from the database. The value of this setting implies whether the container has exclusive or shared access to the database:

    Load at

    • ACTIVATION: Indicates that the bean loads when it is activated (regardless of Activate at setting) and implies that the container has exclusive access to the database.

    • TRANSACTION: Indicates that the bean loads at the start of a transaction and implies that the container has shared access to the database.

    • INTERVAL: (For EJB 2.x only) Indicates that the bean loads at intervals, determined by the integer set in the Load at interval field.

    • DAILY: Indicates that the bean loads its state on a daily basis.

    • WEEKLY: Indicates that the bean loads its state on a weekly basis.

  6. If you select INTERVAL for the load at field, you then indicate the length of time (in seconds) that the reload occurs. The interval is entered as an integer. The INTERVAL option is only available when Activate at is set to ONCE and Load at is set to INTERVAL; at this point, the reload interval text box is activated.

After you define the bean cache settings, you can click Remove to remove the bean cache settings.

EJB container caching option for entity beans

The Enterprise JavaBeans specification defines three EJB caching options: options A, B, or C. Those options define how the EJB container handles entity bean instances between transactions. EJB caching options are set at the bean level, and are part of the IBM extensions deployment descriptor.

BOOT.BY - Tech Industry News         Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     Free SCWCD 1.4 Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free SCBCD 5.0 Study Guide