Search code examples
kotlinquarkusquarkus-panache

quarkus-hibernate-orm complains about no suitable persistence unit for `PanacheEntity` and `PanacheEntityBase`


Warning message

WARN [io.qua.hib.orm.dep.HibernateOrmProcessor] Could not find a suitable persistence unit for model classes:
- io.quarkus.hibernate.orm.panache.kotlin.PanacheEntity
- io.quarkus.hibernate.orm.panache.kotlin.PanacheEntityBase

The same issue with both io.quarkus:quarkus-hibernate-orm-panache and io.quarkus:quarkus-hibernate-orm-panache-kotlin (PanacheCompanion).

My project has multiple named persistent units and datasources (no default). I'm also using multitenant feature.

INFO [io.quarkus] Installed features: [agroal, cache, cdi, config-yaml, hibernate-orm, hibernate-orm-panache-kotlin, jdbc-mysql, kotlin, mutiny, narayana-jta, resteasy, resteasy-jackson, security, smallrye-context-propagation, smallrye-jwt, smallrye-openapi, swagger-ui, vertx, vertx-web]


Solution

  • It seems that the ORM processor doesn't exclude those base entities, and tries to attach them to a non-existent "default" persistent units. Hence the warning.

    I could get rid of it by either define "default" PU or assign io.quarkus.hibernate.orm.panache.kotlin to a named one.

    quarkus:
      hibernate-orm:
        dummy:
          packages: io.quarkus.hibernate.orm.panache.kotlin
          datasource: dummy