Search code examples
grailsgrails-orm

Where are injected domain class methods like isDirty, save, etc defined in Grails / GORM?


I have a problem where isDirty isn't recognizing that an object has changed, even though I can see very clearly via a debugger that it has. I'd like to take a look at the source, but I can't seem to track the source down, and the debugger won't step into it (I assume because it's handled through some sort of AST magic).

I checked out git-core, but "find . -type f | xargs grep -il isDirty" yields no results.

Where can I track this code down?


Solution

  • The ASTs wire in the methods from GormInstanceApi (and GormStaticApi, GormValidationApi, etc.) and individual GORM implementations may subclass those (currently only the Hibernate implementations do).

    For example, the Hibernate 3 implementation is here and the Hibernate 4 implementation is in class of the same name in the grails-datastore-gorm-hibernate4 project (most of the Hibernate code is in the grails-datastore-gorm-hibernate-core project, but due to changed interfaces some is in the two top-level projects).