如何从grails中的表中读取和显示数据

时间:2016-02-26 16:34:58

标签: oracle grails

我有一个oracle数据库,我希望将特定表(类)中的数据显示给我的Grails应用程序。我只是在寻找程序。

谢谢你。 这就是我所拥有的

DataSource.groovy中

dataSource {
    pooled = true
    jmxExport = true

    driverClassName = "oracle.jdbc.OracleDriver"
    username = "hr"
    password = "Destiny"
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
//    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
    singleSession = true // configure OSIV singleSession mode
    flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}

// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:oracle:thin:@localhost:1524:orcldata"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:oracle:thin:@localhost:1524:orcldata"
        }
    }
}

portfolio.groovy

package all

class Portfolio {
    int classid
    String classname     
    int capacity

    static constraints = {

        classid()
        classname()
        capacity()      
    }
    static mapping ={
        table : 'class'

        version false
        columns{
            classid column:'classid'    
            classname column:'classname'    
            capacity column:'capacity'    
        }


    }
}

执行后我收到了这个错误:

2016-02-26 15:17:20,553 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: drop sequence hibernate_sequence

0 个答案:

没有答案