grails PostgreSQL没有创建表

时间:2016-08-08 13:53:41

标签: hibernate grails gorm grails-3.2.0.m2

我在build.gradle中使用grails 3具有以下依赖性

runtime group: 'org.postgresql', name: 'postgresql', version: '9.4.1209'

我的application.yml有以下配置

hibernate:
    cache:
        queries: false
        use_second_level_cache: true
        use_query_cache: false
        region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'

dataSource:
    pooled: true
    jmxExport: true
    driverClassName: org.postgresql.Driver
    username: postgres
    password: test

environments:
    development:
        dataSource:
            dbCreate: create-drop
            url: jdbc:postgresql://localhost:5432/devdb
    test:
        dataSource:
            dbCreate: update
            url: jdbc:postgresql://localhost:5432/testdb
    production:
        dataSource:
            dbCreate: update
            url: jdbc:postgresql://localhost:5432/proddb
            properties:
                jmxEnabled: true
                initialSize: 5
                maxActive: 50
                minIdle: 5
                maxIdle: 25
                maxWait: 10000
                maxAge: 600000
                timeBetweenEvictionRunsMillis: 5000
                minEvictableIdleTimeMillis: 60000
                validationQuery: SELECT 1
                validationQueryTimeout: 3
                validationInterval: 15000
                testOnBorrow: true
                testWhileIdle: true
                testOnReturn: false
                jdbcInterceptors: ConnectionState
                defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
---

我的域类如下所示

import grails.rest.Resource

@Resource(uri='/issue')
class Issue {
    String issueKey
    static constraints = {
    }
}

当服务器启动时,没有创建表,并且在列表屏幕上读取数据时会抛出异常

Caused by: org.postgresql.util.PSQLException: ERROR: relation "issue" does not exist
  Position: 13

相同的代码与H2完美搭配

0 个答案:

没有答案