Quarkus JPA验证模式失败

4

我将进行一个基于 Quarkus 的批处理。

这是我的 application.properties 文件内容:

# datasource configuration
quarkus.datasource.db-kind = oracle
quarkus.datasource.username = XXX
quarkus.datasource.password = XXX
quarkus.datasource.jdbc.url = jdbc:oracle:thin:...

quarkus.hibernate-orm.database.generation=none
quarkus.hibernate-orm.database.default-schema=MYSCHEMA
quarkus.hibernate-orm.dialect=org.hibernate.dialect.Oracle10gDialect

这是MyApp类的方法,只是为了试验是否一切正常运作:

public class MyApp implements QuarkusApplication {

    @Inject
    Logger logger;

    @Inject
    MyDAO myDAO;

    @Override
    public int run(String... args) {
        logger.info("Do startup logic here");
        logger.info("Printing args...");
        Arrays.stream(args).forEach(logger::info);
        fetch();
        Quarkus.waitForExit();
        return 0;
    }

    @Transactional
    protected void fetch() {
        logger.info("fetching riga ordine...");
        final MyEntity output = myDAO.findById("id");
        logger.info("output: {}", output);
    }
}

当我运行我的应用程序时,fetch()方法可以正常工作,并且我可以成功检索到MyEntity,但是我也会收到这个烦人的错误提示:
2022-01-28 11:24:57,450 ERROR [io.qua.hib.orm.run.sch.SchemaManagementIntegrator] (Hibernate post-boot validation thread for <default>) Failed to validate Schema: Schema-validation: missing table [MY_TABLE]
2022-01-28 11:24:57,782 ERROR [io.qua.hib.orm.run.sch.SchemaManagementIntegrator] (Hibernate post-boot validation thread for <default>) The following SQL may resolve the database issues, as generated by the Hibernate schema migration tool. WARNING: You must manually verify this SQL is correct, this is a best effort guess, do not copy/paste it without verifying that it does what you expect.

create table MY_TABLE...

基本上,我无法理解两件事:
1. 我如何关闭模式验证;在 persistence.xml 上,我曾经设置了:
    <property name="hibernate.hbm2ddl.auto" value="none" />

但我不知道如何在Quarkus中复制它。

  1. 尽管我在application.properties中正确设置了模式:

    quarkus.hibernate-orm.database.default-schema=MYSCHEMA

我仍然收到模式验证错误。

证明是,当使用schema="MYSCHEMA"的@Table注释时,我不会收到此错误(但是我不想在实体上存根模式)。

1个回答

1

为了禁用模式验证,请在您的application.properties中设置quarkus.hibernate-orm.validate-in-dev-modefalse


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接