intellij-ideagrailsgrails-domain-class

Grails GORM class with @GrailsCompileStatic annotation shows in the static mapping closure table, version, autoTimestamp as unresolved symbol


References:

  1. https://youtrack.jetbrains.com/issue/IDEA-206196
  2. https://youtrack.jetbrains.com/issue/IDEA-207415?_ga=2.103698112.1724644326.1581075934-247190714.1566820331
package de.equeo.requestcode

import grails.compiler.GrailsCompileStatic

@GrailsCompileStatic
class Feature {

    String name

    static mapping = {
        table 'rq_feature'
        version false
        autoTimestamp false
    }

}

This results in the error in the IDE only (works fine in grails run-app or while compiling):

enter image description here


Solution

  • Instead of doing that you can use the built in type safe dsl added in GORM 6.1

    import static grails.gorm.hibernate.mapping.MappingBuilder.*
    
    class Book {
        String title
    
        static final mapping = orm {