【发布时间】:2021-05-28 11:28:31
【问题描述】:
我遇到了无法让 Quarkus 使用 persistence.xml 的问题。
我的实体没有被发现,所以我在查询时总是收到“不是实体”错误。
(Caused by: java.lang.IllegalArgumentException: Not an entity: ...)
使用 Quarkus 1.13.5.Final
这可能与Quarkus Panache Not Working with persistence.xml after 1.8有关
我正在迁移现有应用,我只有一个包含所有实体的项目。我只使用一个持久化单元。
我的persistence.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="registry-pu" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.enable_lazy_load_no_trans" value="true"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.jdbc.time_zone" value="UTC"/>
</properties>
</persistence-unit>
</persistence>
我只是指定了这些额外的环境变量:
QUARKUS_DATASOURCE_USERNAME=
QUARKUS_DATASOURCE_PASSWORD=
QUARKUS_DATASOURCE_JDBC_URL=
我也只依赖这个persistence.xml,因为被迁移的应用需要enable_lazy_load_no_trans prop 才能工作
任何帮助将不胜感激
【问题讨论】:
标签: quarkus