-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hibernate orm Panache query projection is not working #41657
Comments
/cc @FroMage (panache), @gsmet (hibernate-orm), @loicmathieu (panache), @yrodiere (hibernate-orm) |
Probably an ORM bug related to |
I have found a workaround: @Entity
public class Score extends PanacheEntity {
public String name;
public Long points;
public Score() {
}
public Score(String name, Long points) {
this.name = name;
this.points = points;
}
public static List<Score> total() {
return Score.find("select s.name, SUM(s.points) from Score s group by s.name").project(Score.class).list();
}
} so it seems using int or Integer won't work |
Looks like an ORM bug in int/long conversion? At the very least the error should be better. WDYT @yrodiere should we file it upstream? Probably needs a pure-ORM reproducer… |
+1 please create a reproducer based on https://github.com/hibernate/hibernate-test-case-templates/blob/main/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/QuarkusLikeORMUnitTestCase.java |
Hi everyone, On a sidenote, I have this problem reproducing with Quarkus 3.12.0 and it is working fine on 3.11.2. I checked quickly, these versions seem to use the exact same Hibernate version. |
I am not sure it was filed upstream yet. |
Tried to reproduce upstream, there's a problem with Going to try to debug the reproducer... |
Forget that, a bug in the chair-keyboard interface. I do reproduce the problem with just Hibernate ORM. BUT... it's already been reported and fixed, in 6.6.0.CR1: https://hibernate.atlassian.net/browse/HHH-18214 So, upgrading to Hibernate ORM 6.6 in #41359 will fix the problem. In the meantime @ia3andy: HHH-18214 just caused the reported error to be nonsense, but there was a problem in your code. You can fix it by using |
when do you plan to upgrade to Hibernate ORM 6.6? |
@lfarkas I think the Hibernate ORM 6.6.0 version is not yet released. |
Describe the bug
As described here https://quarkus.io/guides/hibernate-orm-panache#query-projection, it should be possible to project a query in a class.
Expected behavior
This should project correctly
Actual behavior
It currently fail with this exception:
How to Reproduce?
https://github.com/ia3andy/reproducer-hibernate-project
Run the test
Quarkus version or git rev
3.12.0
The text was updated successfully, but these errors were encountered: