Skip to content

Cannot project Panache entity with a coupled collection #42697

Open
@Wouter684

Description

Describe the bug

When trying to project an entity which contains a collection, such as @ElementCollection or @OneToMany, Panache cannot project to a class with a collection type.

Expected behavior

In a projected class, the collection will be returned just like in the entity

Actual behavior

An exception is thrown:

org.hibernate.query.SemanticException: Missing constructor for type 'MyProjectedEntity' [SELECT new org.example.MyProjectedEntity (id,field,myCollection) FROM `org.example.MyEntity` ORDER BY `id`]

How to Reproduce?

https://github.com/Wouter684/cannot-project-with-list/tree/main
Run the unit test in the project. (mvn verify)

Output of uname -a or ver

No response

Output of java -version

openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)  

Quarkus version or git rev

3.13.3

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

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: /Users/<redacted>/.sdkman/candidates/maven/current
Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: /Users/<redacted>/.sdkman/candidates/java/21.0.3-tem
Default locale: nl_NL, platform encoding: UTF-8
OS name: "mac os x", version: "14.6.1", arch: "aarch64", family: "mac"

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions