Including an attribute in a predicate for optimistic access intents
For attributes of EJB 2.x CMP entity beans, the Properties view of the Mapping editor includes a property for optimistic predicate.
If you have an optimistic access intent setup (wsOptimisticUpdate or wsOptimisticRead), you need to specify the attributes that you want to be included in the predicate. If an attribute is set to true, the attribute will be included in the WHERE predicate in the bean's UPDATE SQL statement. By default, the mapping editor sets each attribute to false, except for attributes that are primitive types, which are set to true. The attributes that are included in an optimistic predicate must not be mapped to nullable columns. For more information about optimistic predicates, see the WebSphere Application Server documentation.
- Open the mapping editor for your EJB application.
- In the Overview section of the Mapping editor, select the bean attribute that you want to include in a predicate for optimistic access intent.
- In the Properties view, set the OptimisticPredicate value to true.
Note:
In versions of WebSphere Studio Application Developer earlier than V5.0, adding attributes of an EJB 1.1 CMP entity bean to an optimistic predicate was not supported. However, if you use the workbench to deploy an EJB application that you developed using a version earlier than V5.0 and does not include a list of attributes for an optimistic predicate, all of the available predicates are used. EJB 2.x CMP entity beans are treated differently. If no attributes are selected as predicates, then none are added to the overqualified update.
Parent topic
Specifying optimistic concurrency control scheme for EJB 2.x CMP entity beans