From 4d005b3d19a99157fa468d01ab12480c8c33ec13 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 16 Jul 2023 15:39:20 +0200 Subject: [PATCH] more info about the metamodel in the javadoc for SessionFactory --- .../java/org/hibernate/SessionFactory.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/SessionFactory.java b/hibernate-core/src/main/java/org/hibernate/SessionFactory.java index 8f8e230056..601d0fbbd4 100644 --- a/hibernate-core/src/main/java/org/hibernate/SessionFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/SessionFactory.java @@ -88,12 +88,30 @@ import static org.hibernate.internal.TransactionManagement.manageTransaction; * used in a sophisticated way by libraries or frameworks to implement generic * concerns involving entity classes. *

+ * When the Metamodel Generator is used, elements of this metamodel may also + * be obtained in a typesafe way, via the generated metamodel classes. For + * an entity class {@code Book}, the generated {@code Book_} class has: + *

+ *

+ * Use of these statically-typed metamodel references is the preferred way of + * working with the {@linkplain jakarta.persistence.criteria.CriteriaBuilder + * criteria query API}, and with {@linkplain EntityGraph}s. + *

* The factory also {@linkplain #getSchemaManager() provides} a * {@link SchemaManager} which allows, as a convenience for writing tests: *