Skip to content
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

Load aggregates that have a single one-to-m relationship with a single select #1446

Closed
Tracked by #1445
schauder opened this issue Mar 10, 2023 · 0 comments
Closed
Tracked by #1445
Assignees
Labels
in: jdbc Spring Data JDBC in: single-query-loading Everything related to querying aggregates with a single select. type: enhancement A general enhancement

Comments

@schauder
Copy link
Contributor

schauder commented Mar 10, 2023

This is the first step of implement single-select-querying for Spring Data JDBC.

It will only work for aggregates that have

  • at most a single one-to-m relationship.
  • no embedded entities.
  • no nested entities.

Single Query Loading will be used for the relevant methods of CrudRepository

It should be implemented in a way that allows integration in Spring Data R2DBC

@schauder schauder added type: enhancement A general enhancement in: single-query-loading Everything related to querying aggregates with a single select. in: jdbc Spring Data JDBC labels Mar 10, 2023
schauder added a commit that referenced this issue Apr 12, 2023
- Simple Entities
- single references
- single collections (List, Set, Map)
- conversions get applied on reading
- integrated for the supported databases and findById and findAll.
- integration tests work for Postgres, DB2, MS SqlServer

Next Todos:
- Fix integration tests with Oracle which fail because the magic join doesn't return all expected rows.
- Support for the missing find* methods in SingleSelectDataAccessStrategy

See #1446
@schauder schauder self-assigned this May 17, 2023
schauder added a commit that referenced this issue Jun 15, 2023
Since trivial aggregates consist only of a single table this doesn't make a real difference,
but it demonstrates that the general infrastructure works.

See #1446
schauder added a commit that referenced this issue Jul 21, 2023
Single Query Loading loads as the name suggests complete aggregates using a single select.
While the ultimate goal is to support this for all aggregates, this commit enables it only for simple aggregate and also only for some operations.
A simple aggregate is an aggregate that only reference up to one other entity and does not have embedded entities.
The supported operations are those available via `CrudRepository`: `findAll`, `findById`, and `findAllByIds`.

Single Query Loading does NOT work with the supported in memory databases H2 and HSQLDB, since these do not properly support windowing functions, which are essential for Single Query Loading.

To turn off Single Query Loading call `RelationalMappingContext.setSingleQueryLoadingEnabled(false)`.

Closes #1446
See #1450
See #1445
schauder added a commit that referenced this issue Jul 21, 2023
Single Query Loading loads as the name suggests complete aggregates using a single select.
While the ultimate goal is to support this for all aggregates, this commit enables it only for simple aggregate and also only for some operations.
A simple aggregate is an aggregate that only reference up to one other entity and does not have embedded entities.
The supported operations are those available via `CrudRepository`: `findAll`, `findById`, and `findAllByIds`.

Single Query Loading does NOT work with the supported in memory databases H2 and HSQLDB, since these do not properly support windowing functions, which are essential for Single Query Loading.

To turn off Single Query Loading call `RelationalMappingContext.setSingleQueryLoadingEnabled(false)`.

Closes #1446
See #1450
See #1445
schauder added a commit that referenced this issue Jul 21, 2023
Single Query Loading loads as the name suggests complete aggregates using a single select.
While the ultimate goal is to support this for all aggregates, this commit enables it only for simple aggregate and also only for some operations.
A simple aggregate is an aggregate that only reference up to one other entity and does not have embedded entities.
The supported operations are those available via `CrudRepository`: `findAll`, `findById`, and `findAllByIds`.

Single Query Loading does NOT work with the supported in memory databases H2 and HSQLDB, since these do not properly support windowing functions, which are essential for Single Query Loading.

To turn on Single Query Loading call `RelationalMappingContext.setSingleQueryLoadingEnabled(true)`.

Closes #1446
See #1450
See #1445
@mp911de mp911de added this to the 3.2 M2 (2023.1.0) milestone Aug 15, 2023
@mp911de mp911de changed the title Load aggregates that have a single one-to-m relationship with a single select. Load aggregates that have a single one-to-m relationship with a single select Aug 15, 2023
mp911de added a commit that referenced this issue Aug 15, 2023
Extract Single Query Loading branching to SingleQueryFallbackDataAccessStrategy. Inline AggregateReaderFactory into SingleQueryDataAccessStrategy. Move CachingSqlGenerator to AggregateReader as caching root.

Introduce DataAccessStrategyFactory to encapsulate configuration.

Fix Javadoc tag ordering. Remove superfluous MappingContext parameters when Converter is available. Simplify code. Reformat code.

Reorder Functions methods. Tweak Javadoc, move composite function into SingleQuerySqlGenerator.

See #1446
See #1450
See #1445
Original pull request: #1572
mp911de added a commit that referenced this issue Aug 15, 2023
Transform the tabular structure into a graph of RowDocument associated with nested documents and lists.

Add container license acceptance for updated container images.

See #1446
See #1450
See #1445
Original pull request: #1572
schauder added a commit that referenced this issue Sep 20, 2023
Add github references to tests.

See #1446
mp911de pushed a commit that referenced this issue Sep 27, 2023
Add github references to tests.

See #1446
mp911de pushed a commit that referenced this issue Sep 27, 2023
Add github references to tests.

See #1446
See #1448
Original pull request: #1622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: jdbc Spring Data JDBC in: single-query-loading Everything related to querying aggregates with a single select. type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants