-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Missing feature related to Class-based Projections. #2635
Comments
In light of #2814, have you checked out that this is now valid for
This is a simple approximation of your query, but nevertheless it's legal in our HQL parser, and so should work with Hibernate, assuming you tune it to your specific DTO types. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Very good. I tried something similar before, I can't remember what result I got. However, in my benchmark tests, I discovered that DTO based queries are faster than entity and interface based projections. resultSetTransformer() gave the best results, but their performance was very similar. Interface-based projection uses too much System.gc(). If the System.gc problem is solved, it can perform the same as DTO based projection. Additionally, the execution speed of queries for classes with the return type @ Entity is very slow.
Interface Based Projection GC Activity: visualVm test images of all the queries I compared in the application: |
Given we now have first class support for DTO-based queries in both JPQL as well as HQL, I'm going to close this ticket. If you wish to open a performance-based ticket, I encourage you to open a new ticket so we can tackle that as a separate effort. |
Superseded by #2814. |
Hello Spring Team.
in the document: no nested projections can be applied
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections.dtos
I developed the code as application, did some tests and results. It is possible to query dynamically, without specifying the join type, lazy fields can join automatically without using join fetch or EntityGraph. Compared to the normal Entity class (even when querying the same fields), the speed of the select query is much faster.
The text was updated successfully, but these errors were encountered: