# @ejbgen:entity-cache-ref Annotation

This tags specifies a reference to an application-level entity cache. If the ejbgen:entity-cache-ref is not specified, a separate cache is used for each entity bean.

## Scope

Class tag on an entity bean

## Syntax

@ejbgen:entity-cache-ref

concurrency-strategy="ConcurrencyOption"

name="CacheName"

[cache-between-transactions="True/False"]

[estimated-bean-size="ByteSize"]

## Attributes

concurrency-strategy

Required. Defines the concurrency strategy for the entity bean. Valid values are ReadOnly, Exclusive, and Database. When left unspecified, the default is Database.

name

Required. Names the application-level cache.

cache-between-transactions

Optional. Specifies whether to cache the persistent data of an entity bean across (between) transactions. When left unspecified, the default is false.

estimated-bean-size

Optional. Specifies the estimated average size of an instance of an entity bean, in bytes. When left unspecified, the default is 100.

## Remarks

The following rules apply to this tag's use:

- When entity-cache related attributes are set using the @ejbgen:entity Annotation, such as cache-between-transactions, idle-timeout-seconds, and max-beans-in-cache, the ejbgen:entity-cache-ref tag is ignored.
- Using application-level entity bean caching, and referencing an application-level cache with this tag is discussed in detail in Accelerating Entity Bean Data Access.

Related Topics

Accelerating Entity Bean Data Access

@ejbgen:entity Annotation