Skip to content

Commit eca53a2

Browse files
committed
provide a little code example illustrating HHH-19023
1 parent 395ba4d commit eca53a2

File tree

1 file changed

+7
-4
lines changed
  • hibernate-core/src/main/java/org/hibernate/graph

1 file changed

+7
-4
lines changed

hibernate-core/src/main/java/org/hibernate/graph/Graph.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.util.List;
88

99
import jakarta.persistence.metamodel.Attribute;
10-
import jakarta.persistence.metamodel.EntityType;
1110
import jakarta.persistence.metamodel.ManagedType;
1211
import jakarta.persistence.metamodel.MapAttribute;
1312
import jakarta.persistence.metamodel.PluralAttribute;
@@ -42,9 +41,13 @@
4241
* </ul>
4342
* <p>
4443
* When a graph is defined programmatically, the new graph is usually instantiated by calling
45-
* {@link jakarta.persistence.EntityManager#createEntityGraph(Class)}. However, this requires
46-
* a reference to and {@code EntityManager}, which might not always be convenient. An
47-
* alternative is provided by {@link EntityGraphs#createGraph(EntityType)}.
44+
* {@link jakarta.persistence.EntityManager#createEntityGraph(Class)}. However, this requires a
45+
* reference to and {@code EntityManager}, which might not always be convenient. An alternative
46+
* is provided by {@link EntityGraphs#createGraph(jakarta.persistence.metamodel.EntityType)},
47+
* where the {@code EntityType} may be obtained from the static metamodel:
48+
* <pre>
49+
* EntityGraph&lt;Book&gt; graph = EntityGraphs.createGraph(Book_.class_);
50+
* </pre>
4851
*
4952
* @apiNote Historically, both {@link jakarta.persistence.EntityGraph} and this interface
5053
* declared operations with incorrect generic types, leading to unsound code. This was

0 commit comments

Comments
 (0)