-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Provides query projection for Hibernate with Panache #6261
Comments
Note that I think we don't need it for all use-cases, because if we removed the bound for |
Is this going to be in the next version or anything? Just asking, no pressure. :) |
If we didn't have the bound on String name = Order.find("select name").firstResult();
long max = Order.find("select max(price)").firstResult(); Which is not about projections, but already goes a long way. |
Actually perhaps even: String name = Order.find("name").firstResult();
long max = Order.find("max(price)").firstResult(); Since this is not ambiguous with queries. |
@FroMage if a query starts with Regarding the bound to find, if we didn't add one we will ends up using on of the two following construct for a basic typed usage (the same for your example, if you don't have a bound to find you need to specify the return type in a way) and I didn't like both :
Maybe I'm not seeing exactly what you propose ... |
Sure, but we can change that. As for typing, we currently already have this issue, it's nothing new, and it's due to the way Java's type inference works. Right now the inferred bound will be PanacheQuery<String> q = Order.find("name");
String name = q.firstResult(); We could totally add a |
@FroMage for the records, Quarkus Spring Data compability layer now support returing a different type for a query, this has been implemented by #6691 the fun part is here : https://github.com/quarkusio/quarkus/pull/6691/files#diff-3e72c8149ec469f75ff8ffc49803d6f2R129-R154 it generates a mapper using PanacheQuery.stream().map() ... |
Yeah.. that was fun. I will admit to being quite pleased to get it working. ;) |
Description
Provides the same projection capabilities than for MongoDB with Panace.
See PR #4202
The text was updated successfully, but these errors were encountered: