user manual
Chapter 15: Entity Beans and Table Mapping for CMP 2.0 155
Container-Managed Persistence in Borland Enterprise Server
■
UpdateModifiedFields
■
VerifyModifiedFields
■
VerifyAllFields
SelectForUpdate
Use this option for pessimistic concurrency. With this option specified, the
database locks the row until the current transaction is committed or rolled
back. Other selects on the row are blocked until then.
SelectForUpdateNoWAIT
Use this option for pessimistic concurrency. With this option specified, the
database locks the row until the current transaction is committed or rolled
back. Other selects on the row will fail.
UpdateAllFields
With this option specified, the container issues an update on all fields,
regardless of whether or not they were modified. For example, consider a
CMP entity bean with three fields, KEY, VALUE1, and VALUE2. The following
update will be issued at the terminus of every transaction, regardless of
whether or not the bean was modified:
UPDATE MyTable SET (VALUE1 = value1, VALUE2 = value2) WHERE KEY = key
UpdateModifiedFields
This option is the default optimistic concurrency behavior. The container
issues an update only on the fields that were modified in the transaction, or
suppresses the update altogether if the bean was not modified. Consider the
same bean from the previous example, and assume that only VALUE1 was
modified in the transaction. Using UpdateModifiedFields, the container would
issue the following update:
UPDATE MyTable SET (VALUE1 = value1) WHERE KEY = key
This option can provide a significant performance boost to your application.
Very often data access is read-only. In such cases, not sending an update to
the database upon every transaction saves quite a bit of processing time.
Suppressing these updates also prevents your database implementation from
logging them, also enhancing performance. The JDBC driver is also taxed far
less, especially in large-scale EJB applications. Even for well-tuned drivers,
the less work they have to perform, the better.
VerifyModifiedFields
This option, when enabled, orders the CMP engine to issue a tuned update
while verifying that the updated fields are consistent with their previous values.
If the value has changed in between the time the transaction originally read it
and the time the transaction is ready to update, the transaction will roll back.










