-
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
Support for DTO projections in derived query methods #2363
Comments
@Query
In case a derived query uses a DTO, we now create a select clause that uses a constructor expression for the DTO type. This wasn't supported before and expexted either an interface-based projection or an explicit query using a constructor expression. Fixes #2363.
With the commit for GH-2363, we introduced an unguarded call to ReturnedType.getTypeToRead(), which could return null under certain conditions. Unfortunately Spring Data JPA dod not contain a test case that triggered that scenario. This commit switches to ReturnedType.getReturnedType() which is non-nullable and lets us inspect the calls results for interfaces, which we need to create the JPA query properly. Fixes GH-2408
With the commit for GH-2363, we introduced an unguarded call to ReturnedType.getTypeToRead(), which could return null under certain conditions. Unfortunately Spring Data JPA dod not contain a test case that triggered that scenario. This commit switches to ReturnedType.getReturnedType() which is non-nullable and lets us inspect the calls results for interfaces, which we need to create the JPA query properly. Fixes GH-2408
With the commit for GH-2363, we introduced an unguarded call to ReturnedType.getTypeToRead(), which could return null under certain conditions. Unfortunately Spring Data JPA dod not contain a test case that triggered that scenario. This commit switches to ReturnedType.getReturnedType() which is non-nullable and lets us inspect the calls results for interfaces, which we need to create the JPA query properly. Fixes GH-2408
@odrotbohm projection interface public interface TenantOnly { @DaTa
} Spring Data repository
build versions |
@odrotbohm |
Currently, projecting a query result into a DTO requires the query to be defined explicitly so that the constructor expression to assemble the instances can be declared explicitly. The projection execution of derived query methods currently only supports interface-based projections by reading the required input properties into a JPA
Tuple
.It would be nice if we could create the query to use a constructor expression without that explicit declaration.
Related tickets:
The text was updated successfully, but these errors were encountered: