Previous Topic

Book Contents

Book Index

Next Topic

Locking Modes

In Valuemation, three different Locking Modes may be chosen to be used to retrieve instances of a particular Object Type in the Valuemation Object Type Customizer:

  • Optimistic Locking

    Optimistic concurrency does not involve locking business objects when reading it. With optimistic locking, the user can freely read and modify an object but before the changes are saved, the application checks whether the data has been modified by another user in the meantime. If so, the user is informed that someone else has modified the object since it was loaded and the changes are discarded.

    Select Optimistic lock in the Locking type combo box in the ObjectType Customizer in order to use optimistic locking with instances of the given object type.

    Valuemation views reflect object locking - the currently locked object is opened in the read-only mode of the editor. When the First/Previous/Next/Last buttons are used in the editor, the editor switches between the read-only and edit modes according to the lock status of the currently displayed object.

  • Pessimistic Locking

    Pessimistic concurrency involves locking business objects in order to prevent other users from modifying the data. Other users cannot perform actions that would conflict with the lock until it is released.

    If modification of a currently locked object is attempted, a warning message gets displayed.

    To prevent indefinite locking, the time for which an object is locked is governed by so called 'lock expiration time' - a time interval after which the lock is automatically released. (See below for details.)

    You can enable pessimistic locking for a given object type using the Pessimistic lock combo box in the ObjectType Customizer.

  • No Locking

    If 'No locking' is selected, changes to objects apply whenever the objects are saved, regardless of the order in which they were read from the database.

    Select No lock in the Locking type combo box in the ObjectType Customizer so as not to use any locking with the instances of the given object type.

Each object locking type has its pros and cons. The Optimistic Locking provides higher database throughput but it entails the uncertainty whether object modifications carried out at each particular moment will or will not finally apply.

Object Locking in the 'New' editor

When a new business object is created and saved by the 'Apply' button, the question is whether this object should be locked for editing by other users. This behaviour can can be set by mainparameter 'Lock' / 'LockObjectOnChange'.

  • LockObjectOnChange = False

    If 'LockObjectOnChange' is set to False (or the main parameter does not exist at all), then newly created objects are not locked upon clicking 'Apply'. Although this setting may cause conflicts, for backward compatibility it is the default Valuemation setting.

  • LockObjectOnChange = True

    The strictly correct behaviour is for the object to be locked when 'Apply' is used because at this moment it gets saved in the database and thus can be accessed and modified by other users, giving rise to potential conflicts.

    Set 'LockObjectOnChange' to True to ensure locking of newly created objects while they are still opened in the 'New' editor.

Lock expiration time for pessimistic locking

The following behaviour applies for pessimistic locking:

When an object is opened for editing by one user, it gets locked for all other users. (A lock record for the object is created.) This moment also triggers 'lock expiration time' - a time interval after which the lock is automatically released. Lock expiration time is defined (in milliseconds) in table AMT_BASE, column LOCKTIME. The default value in standard Valuemation is 600 000 ms (3 hours).

When the object is saved during editing (i.e. saved but kept open, command 'doCommitResume'), lock expiration is re-triggered and the expiration period is 1800000 ms (30 min). This default value may result in effectively shortening the expiration time after the save operation. If needed, the default 30 min time can be overridden by adding parameter 'refreshTime' to corresponding session properties file. For example, to renew the expiration time to the initial value after each save, set 'RefreshTime' in the properties file to the same value as LOCKTIME in AMT_BASE.

To override the default 30 min lock expiration ofter save:

  1. In the Valuemation installation folder, locate the properties file used for the session.

    For example, open file 'sessions_Oracle.properties'

  2. Add parameter 'refreshTime' to the top section of the file.

    For example, to extend the lock expiration time after each save to 3 hours, insert 'refreshTime=10800000'

    Help Image

See Also

Working With The Object Types

Creating a New Object Type together with a Table

Creating a New Persistent Object Type

Creating a New Transient Object Type

Editing and Deleting an Object Type

Deleting an Object Type