# getDirtyPropertyNames

## Purpose

Retrieve the names of modified fields in a domain class instance.

## Examples

    def b = Book.get(1)
    someMethodThatMightModifyTheInstance(b)def names = b.dirtyPropertyNames
    for (name in names) {
        def originalValue = b.getPersistentValue(name)
        …
    }

## Description

This method is useful mostly for audit logging or other work done in a beforeUpdate event callback. Hibernate caches the original state of all loaded instances for dirty checking during a flush and this method exposes the names of modified fields so you can compare them with the current state.