Grails

Allow global configuration of GORM settings (cache, identity, nullability etc.)

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.2-M4
  • Component/s: None
  • Labels:
    None

Issue Links

Activity

Hide
Graeme Rocher added a comment -

This is now possible with:

grails.gorm.default.mapping = {
   cache true
   id generator:'sequence'
}
grails.gorm.default.constraints = {
   nullable true
   blank false
   size 1..20
}

In Config.groovy

Show
Graeme Rocher added a comment - This is now possible with:
grails.gorm.default.mapping = {
   cache true
   id generator:'sequence'
}
grails.gorm.default.constraints = {
   nullable true
   blank false
   size 1..20
}
In Config.groovy
Hide
Graeme Rocher added a comment -

Forgot to deal with property defaults as well for ORM mapping

Show
Graeme Rocher added a comment - Forgot to deal with property defaults as well for ORM mapping
Hide
Graeme Rocher added a comment -

Changed the DSL for constraint definition it is now like this:

grails.gorm.default.constraints = {
   '*'(nullable:true, blank:false, size:1..20)
   test matches:/foo/
   another email:true
}

The wildcard '*' is used for globals. The other ones are shared constraints that can be reused in domains like:

static constraints = {
  foo shared:"test"
}
Show
Graeme Rocher added a comment - Changed the DSL for constraint definition it is now like this:
grails.gorm.default.constraints = {
   '*'(nullable:true, blank:false, size:1..20)
   test matches:/foo/
   another email:true
}
The wildcard '*' is used for globals. The other ones are shared constraints that can be reused in domains like:
static constraints = {
  foo shared:"test"
}
Hide
Lari Hotari added a comment -

Nice feature, thanks. Is it possible to enable caching by default for associations (collections) too? (that's been something we've been looking for)

Show
Lari Hotari added a comment - Nice feature, thanks. Is it possible to enable caching by default for associations (collections) too? (that's been something we've been looking for)
Hide
Scott Murphy added a comment -

This broke jpa annotation mappings
GRAILS-5322

Show
Scott Murphy added a comment - This broke jpa annotation mappings GRAILS-5322

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: