gpt4 book ai didi

postgresql - jooq 无法在游戏中生成类 - scala

转载 作者:行者123 更新时间:2023-11-29 12:56:18 25 4
gpt4 key购买 nike

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

在我的生成器设置中,我的设置与 application.conf 中的设置相同,奇怪的是应用程序正常启动并且成功创建了 hikari 连接池,但是 jooq 生成器说无法访问架构。

显示连接有效的游戏控制台日志:

[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 数据库设置:

  default.driver = org.postgresql.Driver
default.url = "jdbc:postgresql://localhost:5432/footballgladiator"
default.username = postgres
default.password = admin
default.maximumPoolSize=9

jook 生成器文件:

<?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>

生成器错误:

[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]

最佳答案

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

 <database>
<name>org.jooq.util.postgres.PostgresDatabase</name>
<inputSchema>public</inputSchema>
<includes>.*</includes>
<excludes></excludes>
</database>

关于postgresql - jooq 无法在游戏中生成类 - scala,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42496041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com