chenk
chenk

Reputation: 75

Disable optimistic locking globally in Grails

What's the best practice for disabling optimistic locking in Grails globally (for all the domain classes) if i'm not using Mongo? Thanks!

Upvotes: 5

Views: 1858

Answers (2)

Anand Kushwaha
Anand Kushwaha

Reputation: 457

By default GORM is configured with optimistic locking enabled. You can disable this by calling the version method with an argument of false:

In your domain class, set a mapping like this:

static mapping = {
// Used to disable optimistic locking
version false
}

Here is a link for Reference

Upvotes: 2

ABC
ABC

Reputation: 4373

If you want to disabling optimistic locking in Grails globally then you can put in Config.groovy

grails.gorm.default.mapping = {
    version false
}

Upvotes: 9

Related Questions