Caching in Entity Beans
Another aspect of caching is to cache the persistent data between transactions. Caching can be enabled by setting the cache-between-transactions element in the weblogic-ejb-jar.xml to either true or false to enable or disable long-term caching of data, respectively. This feature is available if the concurrency strategy is set to exclusive, readonly, or optimistic.
Caching Between Transactions with Exclusive Concurrency—
This feature is available only when running on a single server. It enables caching when the EJB container has exclusive update access to the data store.
Caching Between Transactions with ReadOnly Concurrency—
The EJB container always performs caching of data between transactions when using readonly concurrency.
Caching Between Transactions with Optimistic Concurrency—
The container uses optimistic checking for conflicts at the end of the transaction. This data is broadcast to the other servers on the cluster and data is cached.
An important feature of Entity beans is the capability to do queries. Queries are used to find specific Entity beans and any related Entity beans from the underlying data store. In the next section, we explore the WebLogic-specific extensions to the query mechanism with EJB.
|