[Grails] 《Grails权威指南》中的代码如何在Grails1.0 下运行

loong_lang 2008-03-24
《Grails权威指南》中的代码如何在Grails1.0 下运行
loong_lang 2008-03-24
虽然已将,老版本的代码换成,Grails1.0 的,例如: DataSource
Information:Compilation completed with 5 errors and 0 warnings
Information:5 errors
Information:0 warnings
D:\Workshop\bookmarks\src\java\org\grails\bookmarks\User.java
    Error:Error:line (64)Cannot resolve column 'u_pwd'
    Error:Error:line (10)Cannot resolve table 'user_table'
    Error:Error:line (57)Cannot resolve column 'u_last_name'
    Error:Error:line (49)Cannot resolve column 'u_first_name'
    Error:Error:line (27)Cannot resolve column 'user_id'
loong_lang 2008-03-24
import org.codehaus.groovy.grails.orm.hibernate.cfg.*
dataSource {
    def configClass = GrailsAnnotationConfiguration.class
    pooled = false
//driverClassName = "org.hsqldb.jdbcDriver"
//username = "sa"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"   
    password = ""
}
hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true
    cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop','update'
//url = "jdbc:hsqldb:mem:devDB"
            url = "jdbc:mysql://localhost/bookmarks_dev"
        }
}
test {
dataSource {
dbCreate = "update"
//url = "jdbc:hsqldb:mem:testDb"
            url = "jdbc:mysql://localhost/bookmarks_test"
        }
}
production {
dataSource {
dbCreate = "update"
//url = "jdbc:hsqldb:file:prodDb;shutdown=true"
            url = "jdbc:mysql://localhost/bookmarks_prod"
        }
}
agile_boy 2008-03-24
你是通过JPA来运行的啊?现在是编译错误还是运行错误?
loong_lang 2008-03-24
是的,通过JPA来运行,出现编译错误.
agile_boy 2008-03-24
你确认JPA的annotation正确么?一般来说编译问题还是比较好解决的
loong_lang 2008-03-25
可以确定,JPA的annotation正确.在 IDEA 7.0.2下的错误提示
This inspection controls whether the Persistence ORM annotations are checked against configured Datasources
我估计,还是那个配置缺少
agile_boy 2008-03-25
能将你的工程共享么?可以让更多的人来帮你看这个问题。
loong_lang 2008-03-25
非常乐意,但是怎么才能将工程共享那!
loong_lang 2008-03-25
工程代码已上传,地址 http://grails.group.iteye.com/group/blog/175689,请大家帮忙看看,希望遇到同样问题的给予帮助.
Global site tag (gtag.js) - Google Analytics