Search code examples
grailsgrails-ormgrails-2.0

How do you unlock a domain object after calling lock()?


If you call lock() on a domain instance or statically on the class, and then you decide there is nothing to do to the object, is there a way to manually and immediately release the lock?


Solution

  • To expand on what dmahapatro said, the docs indicate:

    The lock is automatically released when the transaction commits

    so once you call .save(), the lock will be released when the transaction for that save commits (typically at end of service method).

    You may also want to check out these docs.