0

我在 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 完美配合

4

0 回答 0