@@ -597,6 +597,46 @@ public interface Session extends SharedSessionContract, EntityManager {
597
597
*/
598
598
<E > List <E > findMultiple (Class <E > entityType , List <?> ids , FindOption ... options );
599
599
600
+ /**
601
+ * Return the persistent instances of the root entity of the given {@link EntityGraph}
602
+ * with the given identifiers as a list, fetching the associations specified by the
603
+ * graph, which is interpreted as a {@linkplain org.hibernate.graph.GraphSemantic#LOAD
604
+ * load graph}. The position of an instance in the returned list matches the position of
605
+ * its identifier in the given list of identifiers, and the returned list contains a null
606
+ * value if there is no persistent instance matching a given identifier. If an instance
607
+ * is already associated with the session, that instance is returned. This method never
608
+ * returns an uninitialized instance.
609
+ * <p>
610
+ * Every object returned by {@code findMultiple()} is either an unproxied instance of the
611
+ * given entity class, or a fully-fetched proxy object.
612
+ * <p>
613
+ * This method accepts {@link BatchSize} as an option, allowing control over the number of
614
+ * records retrieved in a single database request. The performance impact of setting a batch
615
+ * size depends on whether a SQL array may be used to pass the list of identifiers to the
616
+ * database:
617
+ * <ul>
618
+ * <li>for databases which {@linkplain org.hibernate.dialect.Dialect#supportsStandardArrays
619
+ * support standard SQL arrays}, a smaller batch size might be extremely inefficient
620
+ * compared to a very large batch size or no batching at all, but
621
+ * <li>on the other hand, for databases with no SQL array type, a large batch size results
622
+ * in long SQL statements with many JDBC parameters.
623
+ * </ul>
624
+ * <p>
625
+ * For more advanced cases, use {@link #byMultipleIds(Class)}, which returns an instance of
626
+ * {@link MultiIdentifierLoadAccess}.
627
+ *
628
+ * @param entityGraph the entity graph interpreted as a load graph
629
+ * @param ids the list of identifiers
630
+ * @param options options, if any
631
+ *
632
+ * @return an ordered list of persistent instances, with null elements representing missing
633
+ * entities, whose positions in the list match the positions of their ids in the
634
+ * given list of identifiers
635
+ * @see #byMultipleIds(Class)
636
+ * @since 7.0
637
+ */
638
+ <E > List <E > findMultiple (EntityGraph <E > entityGraph , List <?> ids , FindOption ... options );
639
+
600
640
/**
601
641
* Read the persistent state associated with the given identifier into the given
602
642
* transient instance.
0 commit comments