【发布时间】:2016-06-12 18:01:42
【问题描述】:
早安,
我正在尝试使用 jOOQ 使用 java 进行简单的 postgreSQL 设置。现在我使用 pgadmin3 创建了一个名为 Products 的表,其中包含两列:
CREATE TABLE public."Products"
(
id integer NOT NULL,
username text,
CONSTRAINT id PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public."Products"
OWNER TO postgres;
现在,我正在尝试使用 java 与此表进行交互。我可以从 postgres 请求一个表列表,所以我知道连接有效。但是,如果我尝试进行 maven 安装(以生成为目标,我想要我的 java 类),我会收到以下错误:
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/PublicFactory.java:[15,58] cannot find symbol
symbol: class PostgresFactory
location: package org.jooq.util.postgres
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[12,44] cannot find symbol
symbol: class UpdatableTableImpl
location: package org.jooq.impl
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/Keys.java:[31,120] method createUniqueKey in class org.jooq.impl.AbstractKeys cannot be applied to given types;
required: org.jooq.Table<R>,org.jooq.TableField<R,?>[]
found: org.jooq.util.maven.example.tables.Products,org.jooq.TableField<org.jooq.util.maven.example.tables.records.ProductsRecord,java.lang.Integer>
reason: cannot infer type-variable(s) R
(argument mismatch; org.jooq.util.maven.example.tables.Products cannot be converted to org.jooq.Table<R>)
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/records/ProductsRecord.java:[52,66] incompatible types: org.jooq.util.maven.example.tables.Products cannot be converted to org.jooq.Table<org.jooq.util.maven.example.tables.records.ProductsRecord>
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/PublicFactory.java:[83,62] cannot find symbol
symbol: method getSettings()
location: class org.jooq.util.maven.example.PublicFactory
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[24,9] method does not override or implement a method from a supertype
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[34,125] cannot find symbol
symbol: method createField(java.lang.String,org.jooq.DataType<java.lang.Integer>,org.jooq.util.maven.example.tables.Products)
location: class org.jooq.util.maven.example.tables.Products
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[39,130] cannot find symbol
symbol: method createField(java.lang.String,org.jooq.DataType<java.lang.String>,org.jooq.util.maven.example.tables.Products)
location: class org.jooq.util.maven.example.tables.Products
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[49,9] method does not override or implement a method from a supertype
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[54,9] method does not override or implement a method from a supertype
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/tables/Products.java:[60,9] method does not override or implement a method from a supertype
[ERROR] /home/dries/workspace/postgres/target/generated-sources/jooq/org/jooq/util/maven/example/Public.java:[36,40] method asList in class java.util.Arrays cannot be applied to given types;
required: T[]
found: org.jooq.util.maven.example.tables.Products
reason: varargs mismatch; org.jooq.util.maven.example.tables.Products cannot be converted to org.jooq.Table<?>
似乎确实生成了该类(因为我可以在目标文件夹中找到它)。但是在 eclipse 或 intellij 中,我无法在路径中找到它。 无论哪种方式,构建过程都不应失败。
有人知道构建失败的原因吗?
谢谢,美好的一天。
【问题讨论】:
-
"
PublicFactory" - 你用的是什么古老版本的 jOOQ? :) 介意先升级?另外,能否请您发布您的相关pom.xml配置? -
天哪,我在 3.7.2 上为 jOOQ 但我似乎不小心从 2.6.4 复制粘贴了插件。谷歌搜索结果有时会导致文档版本过时。我将为此责怪星期一!谢谢卢卡斯 :)
-
那么,最好期待周二!
标签: java postgresql maven jooq