Grails com Mysql

0 respostas
T
Ola, Gostaria de saber se alguem usa grails com mysql pois estou com problema com seguintes erros que nao consigo resolver :cry: Ambiente: Mac OS X Console:
groovy> def b = new Book(title:"teste") 
 
1 compilation error:

unable to resolve class Book 
 at line: 1, column: 9

groovy> import teste2.* 
groovy> def b = new Book(title:"teste") 
 
Result: teste2.Book : null 
groovy> import teste2.* 
groovy> def b = new Book(title:"teste") 
groovy> print b.title 
 
teste 
groovy> import teste2.* 
groovy> def b = new Book(title:"teste") 
groovy> b.save() 
 
Exception thrown

groovy.lang.MissingMethodException: No signature of method: teste2.Book.save() is applicable for argument types: () values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), any(), wait(long)
	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:963)
	at teste2.Book.save(Book.groovy)
	at teste2.Book$save.call(Unknown Source)
	at ConsoleScript3.run(ConsoleScript3:4)
	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)
	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)
O data source:
environments {
    development {
        dataSource {
            dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:h2:mem:devDb;MVCC=TRUE"
        }

    }
    dataSource_testando {
    pooled = true
    dbCreate = "create"
    url = "jdbc:mysql://localhost/test"
    driverClassName = "com.mysql.jdbc.Driver"
    dialect = org.hibernate.dialect.MySQL5InnoDBDialect
    username = "u"
    password = "123123"
}
bean:
package teste2

class Book {
 static belongsTo = Author
    static hasMany = [authors:Author]
    String title
    static constraints = {
    }
    static mapping ={

    	datasource 'testando'
    }
}
package teste2

class Author {
 static hasMany = [books:Book]
    String name
    static constraints = {
    }
    static mapping ={
		
    	datasource 'testando'
    }

}
Criado 13 de março de 2012
Respostas 0
Participantes 1