Graphpocalypse: update the docs and migration guide to reflect that key subgraphs are only for Maps

This commit is contained in:
Gavin King 2025-01-03 16:57:02 +01:00
parent 35466f504b
commit 1158838769
2 changed files with 6 additions and 17 deletions

View File

@ -264,16 +264,11 @@ include::{extrasdir}/fetching-strategies-dynamic-fetching-entity-subgraph-exampl
----
====
Specifying a subgraph is only valid for an attribute (or its "key") whose type is a ManagedType. So
while an EntityGraph must correspond to an EntityType, a Subgraph is legal for any ManagedType. An
attribute's key is defined as either:
Specifying a subgraph is only valid for an attribute (or its "key") whose type is a ManagedType.
So while an EntityGraph must correspond to an EntityType, a Subgraph is legal for any ManagedType.
* For a singular attribute, the attribute's type must be an IdentifiableType and that IdentifiableType must
have a composite identifier. The "key subgraph" is applied to the identifier type. The
non-key subgraph applies to the attribute's value, which must be a ManagedType.
* For a plural attribute, the attribute must be a Map and the Map's key value must be a ManagedType.
The "key subgraph" is applied to the Map's key type. In this case, the non-key subgraph applies
to the plural attribute's value/element.
If the attribute is a Map and the Map's key is a ManagedType, the "key subgraph" is applied to the Map's key type.
In this case, the non-key subgraph applies to the Map value/element.
[[fetching-strategies-dynamic-fetching-entity-subgraph-subtype]]
@ -315,14 +310,6 @@ just using a parsed graph rather than a named graph.
The syntax also supports defining "key subgraphs". To specify a key subgraph, `.key` is added
to the end of the attribute name.
.Parsing an entity key graph
====
[source, java, indent=0]
----
include::{example-dir-fetching}/GraphParsingTest.java[tags=fetching-strategies-dynamic-fetching-entity-graph-parsing-key-example-1]
----
====
.Parsing a map key graph
====
[source, java, indent=0]

View File

@ -474,6 +474,8 @@ This package has been significantly re-engineered, and the impact of this effort
- some breaking changes to type signatures, and
- a number of deprecations of legacy operations which are now covered by JPA.
Also, a key subgraph now always refers to a `Map` key, and never to an entity id.
We encourage migration to the use of the new JPA-standard operations.
== Deprecations