Techspace

IT happens only in IT

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.

September 8, 2009 - Posted by | Grails

1 Comment »

  1. Hi Paras,

    I would like to thank you because you helped me with your post.

    Michael

    Comment by Michael Heiniger | October 12, 2009 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.