Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Implementing User and Date Auditing with the Unit of Work

Auditing datasource changes is a common requirement: when a user commits a change to the datasource, the application updates a field in the datasource to record the user who made the change and the date.

For example, suppose each row in your database schema includes fields `lastUpdateBy` (to record the user name of the user who commits a change) and `lastUpdateOn` (to record the date of the change).

You can use `UnitOfWork` method `setProperty` to record the name of the user who acquires the `UnitOfWork` and implement a descriptor event listener for `AboutToUpdateEvent` descriptor events that extracts the property and updates the `lastUpdateBy` and `lastUpdateOn` fields.

For more information, see the following:

- "Acquiring a Unit of Work"

- "Configuring a Domain Object Method as an Event Handler"

- "Configuring a Descriptor Event Listener as an Event Handler"