Quantcast

Grails has stopped creating new tables????

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Grails has stopped creating new tables????

webmediauk
Hey Guys,
Which part of grails actually creates new tables from domain classes?
My app has suddenly stopped creating tables from new domain classes?! Only thing I can thing of that has changed in my environment is that I have installed and then uninstalled the taxonomy plugin?
Any ideas?
Many Thanks
Barry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Grails has stopped creating new tables????

webmediauk
This post was updated on .
The plot thickens!

I've renamed my domain class and used grails console to manipulate it.
So my domain class is called Category. When I start grails console no database table is created. When I then do something like:

new co.uk.tpg.Category( title: 'Cars' ).save( flush: true )

The table is created and my object saved! but if I put something like this into my Bootstrap:

new Category( title: "Finance" ).save( flush: true )

I get an error:

Error executing bootstraps: groovy.lang.MissingMethodException: No signature of method: co.uk.tpg.Category.save() is applicable for argument types: (java.util.LinkedHashMap) values: [[flush:true]]

It's really weird because I have tonnes of other domain objects that I create in the Bootstrap and they all get created fine apart from this one????

Any ideas?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Grails has stopped creating new tables????

gauravchauhan
Grails uses dbCreate property defined in Datasource.groovy to decide whether to create new table or not.

Take a look at the docs : <a href="http://grails.org/doc/1.3.7/guide/3.%20Configuration.html#3.3 The DataSource">http://grails.org/doc/1.3.7/guide/3.%20Configuration.html#3.3 The DataSource

Since you have renamed your  domain class and if your dbCreate property is not set to update then you will have to use mappings closure to map this domain class to old table which had all records.



On Mon, Feb 20, 2012 at 11:46 AM, webmediauk <[hidden email]> wrote:
The plot thickens!

I've renamed my domain class and used grails console to manipulate it.
So my domain class is called Category. When I start grails console no
database table is created. When I then do something like:

new co.uk.tpg.Category( title: 'Cars' ).save( flush: true )

The table is created and my object saved! but if I put something like this
into my Bootstrap:

def categories = Category.list()

or

new Category( title: "Finance" ).save( flush: true )

I get an error:

Error executing bootstraps: groovy.lang.MissingMethodException: No signature
of method: co.uk.tpg.Category.save() is applicable for argument types:
(java.util.LinkedHashMap) values: [[flush:true]]

It's really weird because I have tonnes of other domain objects that I
create in the Bootstrap and they all get created fine apart from this
one????

Any ideas?

--
View this message in context: http://grails.1312388.n4.nabble.com/Grails-has-stopped-creating-new-tables-tp4403711p4404784.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Regards
Gaurav Chauhan
Contact No : +91-95607-66664 
Skype : chauhan.gaurav

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Grails has stopped creating new tables????

burtbeckwith
In reply to this post by webmediauk
Without an explicit import, the default import of groovy.lang.* is taking precendence and groovy.lang.Category is used, not your class.

Burt

On Monday, February 20, 2012 10:46:31 AM webmediauk wrote:

> The plot thickens!
>
> I've renamed my domain class and used grails console to manipulate it.
> So my domain class is called Category. When I start grails console no
> database table is created. When I then do something like:
>
> new co.uk.tpg.Category( title: 'Cars' ).save( flush: true )
>
> The table is created and my object saved! but if I put something like this
> into my Bootstrap:
>
> def categories = Category.list()
>
> or
>
> new Category( title: "Finance" ).save( flush: true )
>
> I get an error:
>
> Error executing bootstraps: groovy.lang.MissingMethodException: No signature
> of method: co.uk.tpg.Category.save() is applicable for argument types:
> (java.util.LinkedHashMap) values: [[flush:true]]
>
> It's really weird because I have tonnes of other domain objects that I
> create in the Bootstrap and they all get created fine apart from this
> one????
>
> Any ideas?
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Grails-has-stopped-creating-new-tables-tp4403711p4404784.html


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Grails has stopped creating new tables????

webmediauk
In reply to this post by gauravchauhan
Thanks for the reply,
This is just in my test environment so I have dropped and recreated the whole database several times.
Everything is setup properly in the datasource and I dont have any issues with my other domain classes, it just seems like this particular domain class is not available in the app but is available in console???
I'm baffled?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Grails has stopped creating new tables????

webmediauk
In reply to this post by burtbeckwith
hey Burt,
Thanks for the help, however the error I'm getting indicates that it is my class being called.
Just to make sure I put:

import co.uk.tpg.Category

At the top of bootstrap.

I'm still getting the error and my Category domain object is not being created anywhere other than grails console?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Grails has stopped creating new tables????

webmediauk
FYI: I solved this issue by backing up my grails app and completely reinstalling Netbeans!
Then manually copying the domain classes and controllers etc in a new grails app.
Must have been IDE related.
Thanks for your help anyway.
Loading...