If you have heavily modified your applicationContext.xml file for your application, make sure you take a copy of it (your whole app to be safe) before you upgrade to a newer version of Grails, since during the ‘grails clean’ and ‘grails upgrade’ steps the applicationContent.xml file will be replaced.
Domain class constraint ‘length’ deprecated in Grails 0.4.2
The domain class constraint ‘length’ has been deprecated in Grails 0.4.2, and needs to be replaced with the equivalent constraint ‘size’ instead.
If you have upgraded to 0.4.2 you may see this error on startup:
<code>Domain class [class ExampleDomain] includes the length constraint for the exampleProperty property. This constraint is deprecated and will be removed in the future. Please update your code to use the size constraint instead. </code>
@Property annotation removed
Generated code in Grails used to use an @Property
annotation to indicate Grails properties. This was used somewhere around version 0.1 – 0.2, was still supported in 0.3.1 (although I think not used in newly generated code), but is now no longer in 0.4.2. You’ll see the error:
<code> @ line 8, column 6.ExampleController: 34: unable to resolve class Property unable to find class for annotation </code>
Just go through your old code if you have migrated from prior versions of Grails and replace the @Property
annotation with def
instead – the code will work with 0.4.2+.
Using pagination with Controller action other than the default list
By default ‘list’ pages are generated to use the <paginate> tag, and this invokes the list
action to retrieve the next set of results.
If you are using an action other than the default list
action, include the action=""
attribute on the tag to use an alternative action method:
<code><g:paginate action="${listType}" total="${Purchase.count()}" /></code>
In the above example the action method is the result of a value set from the previous action method to indicate which action method is to be used.