Logical Unit of Work (LUW)

Official Content
This documentation is valid for:

A Logical Work Unit (LWU) is a set of operations to the database that must be all or none of them executed.

The set of updates that defines a Logical Work Unit, ensures the database’s integrity at a logical level.

The DBMS is responsible for implementing the mechanisms for maintaining the Transactional Integrity and the programs must indicate when the LWU begins and ends.

Example: Suppose an Invoices Transaction object that consists of two levels: the header and the lines. At a logical level, the whole Transaction object is a Logical Unit of Work (LUW) that embraces the header, as well as the lines, because if a failure occurs, it is not desired a header to be recorded without lines or lines without a header.


Logical Work Units (LWU) in GeneXus

  • Transaction objects: The Logical Work Unit’s reach is defined, by default, as the whole Transaction. There is an implicit Commit at the end of the source generated by GeneXus that is executed after each Transaction instance (after recording the record that corresponds to the header and after recording all the records that correspond to the lines).
  • Procedure objects: The Logical Work Unit’s reach is defined, by default, as the whole program. At the end of the source generated by GeneXus a Commit is included.

A different reach can be defined by using the Commit command and Rollback command at any point in the program.

When do you need to use the Commit command for defining a different reach? For example, when you are managing a great quantity of data and smaller transactions want to be defined, so every a certain number of processed records a commit is performed. 

See Also

Commit on exit Property