hibernategrailsgrails-2.0

Grails 2.1: How to use "schema-export export"?


I would like to (re)create my database schema using the command "schema-export". DDL generation works fine, but if I execute "schema export export", I get the following error, which suggest that there is something missing in a configuration file.

grails> dev schema-export export
| Compiling 1 source files.....
Exporting in environment 'development' for the default DataSource
| Error 2012-08-24 14:45:57,466 [main] ERROR hbm2ddl.SchemaExport  - schema export unsuccessful
Message: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
  Line | Method
->> 61 | doCall in SchemaExport$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| Error 2012-08-24 14:45:57,472 [main] ERROR hbm2ddl.SchemaExport  - schema export unsuccessful
Message: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
  Line | Method
->> 64 | doCall in SchemaExport$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

My DataSource.groovy defines a "dataSource":

dataSource {
    pooled = true
    driverClassName = "com.mysql.jdbc.Driver"
}
...
environments {
    development {
        dataSource {
            username = "xxx"
            password = "yyy"
            url = "jdbc:mysql://localhost:3306/chrono_dev?autoreconnect=true"
        }
    }
    ...
}

Any suggestions how to fix this error?


Solution

  • I am not sure why it works now, but it does. I have switched to Postgres, maybe it has got something to do with this. Sorry for bothering you.