首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jooq无法在play - scala中生成类

jooq无法在play - scala中生成类
EN

Stack Overflow用户
提问于 2017-02-28 05:24:50
回答 1查看 192关注 0票数 1

我在scala play框架应用程序中使用jooq,我已经从mariadb更改到postgre 9.5.3,并且我试图为jooq生成模型类,但在生成过程中收到错误。

在我的生成器设置中,我有与application.conf中相同的设置,奇怪的是,应用程序正常启动,hikari连接池成功创建,但jooq生成器显示无法访问模式。

播放控制台的日志,显示连接正常:

代码语言:javascript
复制
[info] 2017-02-27 22:12:25,670 application - Creating Pool for datasource 'default'
[info] 2017-02-27 22:12:26,156 p.a.d.DefaultDBApi - Database [default] connected at jdbc:postgresql://localhost:5432/footballgladiator
[info] 2017-02-27 22:12:26,377 application - ApplicationTimer demo: Starting application at 2017-02-27T21:12:26.356Z.
[info] 2017-02-27 22:12:27,501 play.api.Play - Application started (Dev)

applicatoin.conf数据库设置:

代码语言:javascript
复制
  default.driver = org.postgresql.Driver
  default.url = "jdbc:postgresql://localhost:5432/footballgladiator"
  default.username = postgres
  default.password = admin
  default.maximumPoolSize=9

jook生成器文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.7.0.xsd">
    <jdbc>
        <driver>org.postgresql.Driver</driver>
        <url>jdbc:postgresql://localhost:5432/footballgladiator</url>
        <user>postgres</user>
        <password>admin</password>
    </jdbc>
    <generator>
        <name>org.jooq.util.ScalaGenerator</name>
        <database>
            <name>org.jooq.util.postgres.PostgresDatabase</name>
            <inputSchema>footballgladiator</inputSchema>
            <includes>.*</includes>
            <excludes></excludes>
        </database>
        <target>
            <packageName>generated</packageName>
            <directory>app</directory>
        </target>
    </generator>
</configuration>

生成器错误:

代码语言:javascript
复制
[debug] 2017-02-27 22:06:52,882 o.j.t.LoggerListener - Executing query          : select "pg_catalog"."pg_namespace"."nspname" from "pg_catalog"."pg_namespace"
[debug] 2017-02-27 22:06:52,952 o.j.t.StopWatch - Query executed           : Total: 92.925ms
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener - Fetched result           : +---------------+
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |nspname        |
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : +---------------+
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |pg_toast       |
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |pg_temp_1      |
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |pg_toast_temp_1|
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |pg_catalog     |
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |public         |
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : +---------------+
[debug] 2017-02-27 22:06:53,152 o.j.t.LoggerListener -                          : |...1 record(s) truncated...
[debug] 2017-02-27 22:06:53,153 o.j.t.StopWatch - Finishing                : Total: 293.304ms, +200.378ms
[warn] 2017-02-27 22:06:53,155 o.j.u.AbstractDatabase - No schemata were loaded  : Please check your connection settings, and whether your database (and your database version!) is re
ally supported by jOOQ. Also, check the case-sensitivity in your configured <inputSchema/> elements : [footballgladiator]
EN

回答 1

Stack Overflow用户

发布于 2017-02-28 05:39:00

啊,我发现了,inputSchema被命名为 public ,而不是我的数据库,postgres有一个名为public的模式,您的数据库在其中,所以生成器设置应该是

代码语言:javascript
复制
 <database>
        <name>org.jooq.util.postgres.PostgresDatabase</name>
        <inputSchema>public</inputSchema>
        <includes>.*</includes>
        <excludes></excludes>
    </database>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42496041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档