-
Notifications
You must be signed in to change notification settings - Fork 350
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
JdbcAggregateTemplate honors columns specified in query #1967
base: main
Are you sure you want to change the base?
Conversation
If no columns are given, all columns are selected by default. If columns are specified, only these are selected. Joins normally triggered by columns from 1:1 relationships are not implemented, and the corresponding columns don't get loaded and can't be specified in a query. Limiting columns is not supported for single query loading. Closes #1803
155004e
to
cbde1e7
Compare
Extract method. Extend tests. Introduce empty Query object to avoid nullability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mapping is missing in case a property uses a renamed column, see SqlGeneratorUnitTests.DummyEntity.id
and the updated test selectByQueryWithColumnLimit
.
|
||
if (!CollectionUtils.isEmpty(query.getColumns())) { | ||
for (SqlIdentifier columnName : query.getColumns()) { | ||
columns.add(Column.create(columnName, table)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Column selection is missing the mapping from property name to column name. Columns (property paths specifically) should be mapped. Ideally, we can reuse the loop below regarding its functionality with just the input columns to derive property paths from. Also, we do not assume that all columns are mapped onto our domain entities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
If no columns are given, all columns are selected by default.
If columns are specified, only these are selected.
Joins normally triggered by columns from 1:1 relationships are not implemented, and the corresponding columns don't get loaded and can't be specified in a query.
Limiting columns is not supported for single query loading.
Closes #1803