Grails – No such property: save for class

      1 Comment on Grails – No such property: save for class

I suddenly started getting this message in my grails app. I don’t know the root cause of the problem. But for me the cause of the problem was removal of some fields and renaming of certain fields in domain class. If you have rename and/or removed some fields then make sure you follow these steps

  1. Stopped the running grails application. Changes made in the domains, controllers and other grails-app artifacts sometimes doesn’t get updated while application is running
  2. Remove and update the reference of the removed or renamed fields from the gsp, constraints block of domain, any other static blocks in referenced domains, messages.properties and other property files.
  3. If you are not using in-memory db(HSQL) and using mysql or any other persistent database, then corresponding columns of the renamed/removed old fields are not deleted from database. If it does not affect the already existing data in DB then drop the corresponding table. When you restart application, grails will create the table for you again. If your table has foreign key reference, then drop the database altogether and create new DB and grant all privileges to the user used by Grails.
  4. If the above steps don’t work for you and you are using grails 1.1.1 then try doing MyDomainClass.get(-1) in your Bootstrap.groovy. See http://grails.1312388.n4.nabble.com/No-such-property-save-for-class-td1389894.html

This solved my No such property: save for class issue. YMMV. In your case, the cause may be different.

One thought on “Grails – No such property: save for class

Leave a Reply

Your email address will not be published. Required fields are marked *