116
container-serialized
(Default.) The container insures the transaction serialization. This policy is suitable for most
entity beans, particularly if the bean is accessed only from this container (shared = false).
container-read-committed
This policy is also container-serialized, except that accesses of outside transaction do not interfere
with transactional accesses. This can avoid deadlocks when accessing a bean concurrently with
and without a transactional context. The only drawback of this policy is that it consumes more
memory (two instances instead of one).
container-read-uncommitted
All methods share the same instance (as with container-serialized), but there is no synchroniza-
tion. This policy is interesting for read-only entity beans or if the bean instances are very rarely
modified. It will fail if two or more threads try to modify the same instance concurrently.
database
Let the database deal with transaction isolation. With this policy, you can choose the transaction
isolation in your database. This may be interesting for applications that heavily use transactional
read-only operations, or when the shared flag is needed. It does not work with all databases, and
is expensive in terms of memory.
Note
If you deploy CMP1 beans, you should use the default policy only (container-serialized), unless your
beans are "read-only." In this latter case, you could use container-read-uncommitted.
8.12.2. shared
This flag will be defined as
Server. When this flag is
the bean state before starting a new transaction. The default value is
container-serialized
8.12.3. prefetch
This is a CMP2-specific option. The default is false. To optimize further accesses inside the same
transaction, set the value to true to cache the data that is buffered after finder methods.
Notes
You cannot set the prefetch option when the lock policy is container-read-uncommitted.
•
The prefetch will be used only for methods that have transactional context.
•
if the bean persistent state can be accessed outside the JOnAS
true
, the JOnAS Server can do some optimization, such as not re-reading
false
, and
in the other cases.
true
Chapter 8. Developing Entity Beans
if the lock-policy is
false
Need help?
Do you have a question about the APPLICATION SERVER - JONAS and is the answer not in the manual?
Questions and answers