Quarkus not discovering @Entity entities for persistence.xml based configuration

I'm running into an issue where I can't get Quarkus to work with persistence.xml.

My entities are not discovered so I always get "Not an entity" errors when querying.

(Caused by: java.lang.IllegalArgumentException: Not an entity: ...)

Using Quarkus 1.13.5.Final

This might be related to Quarkus Panache Not Working with persistence.xml after 1.8

I'm migrating an existing app, I only have a single project that contains all the entities. I only use a single persistence unit.

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

I'm only specifying these additional env variables:

QUARKUS_DATASOURCE_USERNAME=
QUARKUS_DATASOURCE_PASSWORD=
QUARKUS_DATASOURCE_JDBC_URL=

I'm also only relying on this persistence.xml because the app being migrated needs the enable_lazy_load_no_trans prop to work

Any help would be appreciated

Upvotes: 0

Views: 663

Answers (1)

Snr
Snr

Reputation: 1

Found I had to add <class>EntityClass</class> entries to the <persistence-unit> tag for each of my entities to have them included. Otherwise you may be able to try <exclude-unlisted-classes>false</exclude-unlisted-classes>

Upvotes: 0

Related Questions