So long since my last post … But finally here I come again with a new post related to a Grails bug and a quick workaround.
I previously saw on the web some other blogs commenting about a GORM dynamic method loading issue (here and here). However, this issue seems to be related to the 1.1.1 revision of Grails and I didn’t consider it a lot since I’m still running 1.0.3 … Found today a quite similar issue into 1.0.3 release but occuring on static methods you may have defined yourself (and not dynamically injected into class by GORM).
It may produce some awful errors like this one :
MissingMethodException: No signature of method: static Membership.link() is applicable ...
happening on static method defined in the domain class itself. See for example the link method of the Membership class in this Grails sample.
As stated in Peter Delahunty blog the ‘loading on Bootstap’ trick seems to work well for that issue too. As this problem was only raised during my integration tests, I’ve also succeed in making an extra call to the count method before the first invocation of link method onto the Membership class.
Something like :
def m = Membership.link(employee, team) // Works now - was previously failing !
Happy coding !