Deal of the Day

Home » Main » Manning Forums » 2008 » Grails in Action

Thread: Quote.save()

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 36 - Pages: 3 [ Previous | 1 2 3 ] - Last Post: Apr 23, 2010 12:43 AM by: roamy
parsifal

Posts: 1
From: Minneapolis
Registered: 12/7/09
Re: Quote.save()
Posted: Dec 7, 2009 8:26 PM   in response to: tsuyo in response to: tsuyo
  Click to reply to this thread Reply

Tsuyo,

That fixed my wagon as well -- THANKS! Now I have a fun little fix-all for Grails apps ;)

I have a suspicion that this problem was caused by stale information (.class files, or a lack thereof?), and doing a "grails clean" woke Grails up, and everything was peachy.

kups


Posts: 3
From: St. Louis, Missouri, USA
Registered: 7/11/09
Re: Quote.save()
Posted: Dec 29, 2009 11:02 AM   in response to: gemini929 in response to: gemini929
  Click to reply to this thread Reply

Tsuyo (and all):

grails clean worked for me, too. I was having the same problems mentioned when attempting save() and count(). Running grails clean got me going again.

I'm running Grails 1.1.1.

Thanks.

nikalme

Posts: 4
From: NY
Registered: 4/1/10
Re: Quote.save()
Posted: Apr 1, 2010 12:15 AM   in response to: tsuyo in response to: tsuyo
  Click to reply to this thread Reply

I am sorry guys but grails clean also does not work for me. I have also tried re - doing the application making sure that the database schema does not have any constraints. I am running grails 1.2.2

drewbono

Posts: 1
Registered: 4/1/10
Re: Quote.save()
Posted: Apr 1, 2010 8:24 PM   in response to: nikalme in response to: nikalme
  Click to reply to this thread Reply

Having the same problem as nikalme. I'm on Grails 1.2.2 (Mac) and am getting this error that isn't resolved by cleaning.

marcelo58

Posts: 2
Registered: 4/21/10
Re: Quote.save()
Posted: Apr 21, 2010 9:15 AM   in response to: drewbono in response to: drewbono
  Click to reply to this thread Reply

Just got the book and noticed the same problem. What is causing the problem is the package (domain/qotd/Quote.groovy). If you move Quote groovy to the default location it will work with no problems. I was able to find out that when created a domain class you need to put a "." in front it will put the class in the "default" directory (in the /domain and not /dmain/qotd). For example:
grails create-domain-class .Quote

Hope this helps!
Regards,
Marcelo

marcelo58

Posts: 2
Registered: 4/21/10
Re: Quote.save()
Posted: Apr 21, 2010 9:29 AM   in response to: marcelo58 in response to: marcelo58
  Click to reply to this thread Reply

You can also leave the application "as is" with the domain in the package "qotd" and when you are doing the SQL just add the "qotd" package.

new qotd.Quote(author: 'Larry Wall', content: 'There is more than one method to our madness.').save()

Marcelo

roamy

Posts: 1
From: santa fe nm
Registered: 4/23/10
Re: Quote.save()
Posted: Apr 23, 2010 12:43 AM   in response to: marcelo58 in response to: marcelo58
  Click to reply to this thread Reply

Well I am on 1.2.2 and thank you very much I changed the directory and did a clean and it now works. But I would have been lost in space without this forum.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff