Table of contents



Official Content

A Logical Unit of Work (LUW) 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 Unit of Work 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 LUW begins and ends.

Example: Suppose there is an Invoices Transaction object consisting of two levels: header and lines. At the logical level, the entire Transaction object is a Logical Unit of Work (LUW) that includes the header as well as the lines, because if a failure occurs, the header should not be recorded without lines or the lines without a header.


Logical Units of Work (LUW) in GeneXus

  • Transaction objects: The Logical Unit of Work’s scope is defined, by default, as the entire 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 Unit of Work’s scope is defined, by default, as the entire program. At the end of the source generated by GeneXus, a Commit is included.

A different scope 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 scope? For example, when you are managing a large volume of data and want to define smaller transactions in order to perform a commit after a certain number of records is processed. 

See Also

Commit on exit Property





Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant