You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/jdbc/entity-persistence.adoc
+5-3
Original file line number
Diff line number
Diff line change
@@ -28,18 +28,20 @@ If the aggregate root references other entities those are loaded with separate s
28
28
With this an arbitrary number of aggregates can be fully loaded with a single SQL query.
29
29
This should be significant more efficient, especially for complex aggregates, consisting of many entities.
30
30
+
31
-
Currently, Single Query Loading is restricted to:
31
+
Currently, Single Query Loading is restricted in different ways:
32
32
33
-
1. It only works for aggregates that only reference one entity collection.The plan is to remove this constraint in the future.
33
+
1. The aggregate must not have nested collections, this includes `Map`.The plan is to remove this constraint in the future.
34
34
35
-
2. The aggregate must also not use `AggregateReference` or embedded entities.The plan is to remove this constraint in the future.
35
+
2. The aggregate must not use `AggregateReference` or embedded entities.The plan is to remove this constraint in the future.
36
36
37
37
3. The database dialect must support it.Of the dialects provided by Spring Data JDBC all but H2 and HSQL support this.H2 and HSQL don't support analytic functions (aka windowing functions).
38
38
39
39
4. It only works for the find methods in `CrudRepository`, not for derived queries and not for annotated queries.The plan is to remove this constraint in the future.
40
40
41
41
5. Single Query Loading needs to be enabled in the `JdbcMappingContext`, by calling `setSingleQueryLoadingEnabled(true)`
42
42
43
+
If any condition is not fulfilled Spring Data JDBC falls back to the default approach of loading aggregates.
44
+
43
45
NOTE: Single Query Loading is to be considered experimental.
0 commit comments