@@ -314,34 +314,47 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
314
314
<T > T doReturningWork (ReturningWork <T > work );
315
315
316
316
/**
317
- * Create a new mutable {@link EntityGraph} with only a root node.
317
+ * Create a new mutable instance of {@link EntityGraph}, with only
318
+ * a root node, allowing programmatic definition of the graph from
319
+ * scratch.
318
320
*
319
321
* @param rootType the root entity class of the graph
320
322
*
321
323
* @since 6.3
324
+ *
325
+ * @see org.hibernate.graph.EntityGraphs#createGraph(jakarta.persistence.metamodel.EntityType)
322
326
*/
323
327
<T > RootGraph <T > createEntityGraph (Class <T > rootType );
324
328
325
329
/**
326
- * Create a new mutable copy of the named {@link EntityGraph},
327
- * or return {@code null} if there is no graph with the given
328
- * name.
330
+ * Create a new mutable instance of {@link EntityGraph}, based on
331
+ * a predefined {@linkplain jakarta.persistence.NamedEntityGraph
332
+ * named entity graph}, allowing customization of the graph, or
333
+ * return {@code null} if there is no predefined graph with the
334
+ * given name.
329
335
*
330
336
* @param graphName the name of the graph
331
337
*
338
+ * @apiNote This method returns {@code RootGraph<?>}, requiring an
339
+ * unchecked typecast before use. It's cleaner to obtain a graph using
340
+ * {@link #createEntityGraph(Class, String)} instead.
341
+ *
342
+ * @see SessionFactory#getNamedEntityGraphs(Class)
332
343
* @see jakarta.persistence.EntityManagerFactory#addNamedEntityGraph(String, EntityGraph)
333
344
*
334
345
* @since 6.3
335
346
*/
336
347
RootGraph <?> createEntityGraph (String graphName );
337
348
338
349
/**
339
- * Create a new mutable copy of the named {@link EntityGraph},
340
- * or return {@code null} if there is no graph with the given
341
- * name.
350
+ * Create a new mutable instance of {@link EntityGraph}, based on
351
+ * a predefined {@linkplain jakarta.persistence.NamedEntityGraph
352
+ * named entity graph}, allowing customization of the graph, or
353
+ * return {@code null} if there is no predefined graph with the
354
+ * given name.
342
355
*
343
356
* @param rootType the root entity class of the graph
344
- * @param graphName the name of the graph
357
+ * @param graphName the name of the predefined named entity graph
345
358
*
346
359
* @see jakarta.persistence.EntityManagerFactory#addNamedEntityGraph(String, EntityGraph)
347
360
*
@@ -353,21 +366,29 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
353
366
<T > RootGraph <T > createEntityGraph (Class <T > rootType , String graphName );
354
367
355
368
/**
356
- * Retrieve the named {@link EntityGraph} as an immutable graph,
357
- * or return {@code null} if there is no graph with the given
369
+ * Obtain an immutable reference to a predefined
370
+ * {@linkplain jakarta.persistence.NamedEntityGraph named entity graph}
371
+ * or return {@code null} if there is no predefined graph with the given
358
372
* name.
359
373
*
360
- * @see jakarta.persistence.EntityManagerFactory#addNamedEntityGraph(String, EntityGraph)
374
+ * @param graphName the name of the predefined named entity graph
361
375
*
362
- * @param graphName the name of the graph
376
+ * @apiNote This method returns {@code RootGraph<?>}, requiring an
377
+ * unchecked typecast before use. It's cleaner to obtain a graph using
378
+ * the static metamodel for the class which defines the graph, or by
379
+ * calling {@link SessionFactory#getNamedEntityGraphs(Class)} instead.
380
+ *
381
+ * @see SessionFactory#getNamedEntityGraphs(Class)
382
+ * @see jakarta.persistence.EntityManagerFactory#addNamedEntityGraph(String, EntityGraph)
363
383
*
364
384
* @since 6.3
365
385
*/
366
386
RootGraph <?> getEntityGraph (String graphName );
367
387
368
388
/**
369
- * Retrieve all named {@link EntityGraph}s with the given type.
389
+ * Retrieve all named {@link EntityGraph}s with the given root entity type.
370
390
*
391
+ * @see jakarta.persistence.EntityManagerFactory#getNamedEntityGraphs(Class)
371
392
* @see jakarta.persistence.EntityManagerFactory#addNamedEntityGraph(String, EntityGraph)
372
393
*
373
394
* @since 6.3
0 commit comments