Skip to content

HibernateOrmProcessor complains about abstract model classes not mapped to a PersistenceUnit #22183

@renegrob

Description

@renegrob

Describe the bug

If hibernate entity packages are explicitly listed (e.g. to map them to a specific PersistenceUnit), the HibernateOrmProcessor complains that their abstract super classes and interfaces are not mapped to a PersistenceUnit:

application.yaml

quarkus:
  hibernate-orm:
    packages:
      - 'com.github.renegrob.entity'

Build output:

./gradlew clean build

> Task :quarkusGenerateCode
preparing quarkus application

> Task :quarkusGenerateCodeTests
preparing quarkus application
Could not find a suitable persistence unit for model classes:
        - com.github.renegrob.INamedEntity
        - io.quarkus.hibernate.orm.panache.PanacheEntity

> Task :quarkusBuild
building quarkus jar

BUILD SUCCESSFUL in 6s

The log message seems to be produced in io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor line 1054.
In my opinion abstract classes (and those annoted with @MappedSuperclass) and interfaces should not be listed - but maybe I'm mistaken.
I would expect that abstract super classes and interfaces can be shared among different PersistentUnits.

Expected behavior

In the describe scenario no such log message is produced.

Actual behavior

See bug description

How to Reproduce?

  1. Checkout https://github.com/renegrob/reproducer-base/tree/no-suitable-persistence-unit
  2. ./gradlew clean build
  3. You will see the following build output:
...
preparing quarkus application
Could not find a suitable persistence unit for model classes:
        - com.github.renegrob.INamedEntity
        - io.quarkus.hibernate.orm.panache.PanacheEntity
...

Output of uname -a or ver

Linux automatix 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.13" 2021-10-19 LTS OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS) OpenJDK 64-Bit Server VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)

GraalVM version (if different from Java)

n/a

Quarkus version or git rev

2.5.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------
Gradle 7.3.1
------------------------------------------------------------

Build time:   2021-12-01 15:42:20 UTC
Revision:     2c62cec93e0b15a7d2cd68746f3348796d6d42bd

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.13 (Azul Systems, Inc. 11.0.13+8-LTS)
OS:           Linux 5.11.0-41-generic amd64

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions