Skip to content

Panache projection handles primitive type incorrectly #43368

@joachimglink

Description

@joachimglink

Describe the bug

I have a POJO with a constructor of some fields (some are objects like a String, others are primitive types like boolean or short).
If I do a "select new MyPojo(...)" query, it works fine and the POJO is created as expected.

But when using the #project(..) method from PanacheQuery, I get an error for a missing constructor. Only if I change the constructor of the POJO to have no primitive types but the object types (long->Long, boolean->Boolean) this works again.

Expected behavior

The Panache projection should also work with primitive types.

Actual behavior

No response

How to Reproduce?

Working:
((Session) MyEntity.getEntityManager()).createQuery("select new MyPojo(attribString, attribBoolean) from MY_ENTITY).list();

Not working:
MyEntity.find(select attribString, attribBoolean) from MY_ENTITY).project(MyPojo.class).list()

Output of uname -a or ver

No response

Output of java -version

21

Quarkus version or git rev

3.14.4

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

mvn

Additional information

No response

Metadata

Metadata

Assignees

Labels

area/hibernate-ormHibernate ORMkind/bug-thirdpartyBugs that are caused by third-party components and not causing a major dysfunction of core Quarkus.kind/enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions