| 
12 | 12 | import org.hibernate.query.criteria.JpaCriteriaInsert;  | 
13 | 13 | 
 
  | 
14 | 14 | /**  | 
15 |  | - * Contract for things that can produce instances of {@link Query} and {@link NativeQuery}.  | 
 | 15 | + * An object which can produce instances of {@link SelectionQuery} and {@link MutationQuery}.  | 
16 | 16 |  * Implementors include {@link org.hibernate.Session} and {@link org.hibernate.StatelessSession}.  | 
17 | 17 |  * Many operations of the interface have the same or very similar signatures to operations of  | 
18 | 18 |  * {@link jakarta.persistence.EntityManager}. They are declared here to allow reuse by  | 
19 | 19 |  * {@code StatelessSession}.  | 
20 | 20 |  * <p>  | 
21 |  | - * Operations like {@link #createQuery(String, Class)}, {@link #createNamedQuery(String, Class)},  | 
22 |  | - * and {@link #createNativeQuery(String, Class)} accept an instance indicating the return type  | 
23 |  | - * of the query.  | 
 | 21 | + * There are three fundamental ways to express a query:  | 
 | 22 | + * <ul>  | 
 | 23 | + * <li>in <em>Hibernate Query Language</em>, an object-oriented query dialect of SQL which is  | 
 | 24 | + *     a superset of the <em>Jakarta Persistence Query Language</em>,  | 
 | 25 | + * <li>in the native SQL dialect of the database, or  | 
 | 26 | + * <li>using the {@linkplain jakarta.persistence.criteria.CriteriaBuilder Criteria API} defined  | 
 | 27 | + *     by JPA, along with {@linkplain org.hibernate.query.criteria.HibernateCriteriaBuilder  | 
 | 28 | + *     extensions} defined by Hibernate.  | 
 | 29 | + * </ul>  | 
 | 30 | + * <p>  | 
 | 31 | + * In each case, the object used to execute the query depends on whether the query is a  | 
 | 32 | + * selection query or a mutation query.  | 
 | 33 | + * <ul>  | 
 | 34 | + * <li>selection queries are executed via an instance of {@link SelectionQuery}, while  | 
 | 35 | + * <li>mutation queries are executed via an instance of {@link MutationQuery}, but  | 
 | 36 | + * <li>since JPA makes no such distinction within its API, the type {@link Query} is a mixin of  | 
 | 37 | + *     {@code SelectionQuery}, {@code MutationQuery}, and {@link jakarta.persistence.TypedQuery}.  | 
 | 38 | + * </ul>  | 
 | 39 | + * This interface declares operations for creating instances of these objects.  | 
 | 40 | + * <table style="width:100%;margin:10px">  | 
 | 41 | + *     <tr>  | 
 | 42 | + *         <th style="width:10%"></th>  | 
 | 43 | + *         <th style="text-align:left;width:45%">Selection</th>  | 
 | 44 | + *         <th style="text-align:left;width:45%">Mutation</th>  | 
 | 45 | + *     </tr>  | 
 | 46 | + *     <tr>  | 
 | 47 | + *         <td>HQL</td>  | 
 | 48 | + *         <td>{@link #createSelectionQuery(String,Class)} and  | 
 | 49 | + *             {@link #createSelectionQuery(String,EntityGraph)}</td>  | 
 | 50 | + *         <td>{@link #createMutationQuery(String)}</td>  | 
 | 51 | + *     </tr>  | 
 | 52 | + *     <tr>  | 
 | 53 | + *         <td>SQL</td>  | 
 | 54 | + *         <td>{@link #createNativeQuery(String,Class)} and  | 
 | 55 | + *             {@link #createNativeQuery(String,String,Class)}</td>  | 
 | 56 | + *         <td>{@link #createNativeMutationQuery(String)}</td>  | 
 | 57 | + *     </tr>  | 
 | 58 | + *     <tr>  | 
 | 59 | + *         <td>Criteria</td>  | 
 | 60 | + *         <td>{@link #createSelectionQuery(CriteriaQuery)}</td>  | 
 | 61 | + *         <td>{@link #createMutationQuery(CriteriaUpdate)},  | 
 | 62 | + *             {@link #createMutationQuery(CriteriaDelete)}, and  | 
 | 63 | + *             {@link #createMutationQuery(JpaCriteriaInsert)}</td>  | 
 | 64 | + *     </tr>  | 
 | 65 | + *     <tr>  | 
 | 66 | + *         <td>Named queries</td>  | 
 | 67 | + *         <td>{@link #createNamedSelectionQuery(String,Class)}</td>  | 
 | 68 | + *         <td>{@link #createNamedMutationQuery(String)}</td>  | 
 | 69 | + *     </tr>  | 
 | 70 | + * </table>  | 
 | 71 | + * <p>  | 
 | 72 | + * Operations like {@link #createSelectionQuery(String, Class) createSelectionQuery()},  | 
 | 73 | + * {@link #createNamedSelectionQuery(String, Class) createNamedSelectionQuery()}, and  | 
 | 74 | + * {@link #createNativeQuery(String, Class) createNativeQuery()} accept a Java  | 
 | 75 | + * {@linkplain Class class object} indicating the <em>result type</em> of the query.  | 
24 | 76 |  * <ul>  | 
25 | 77 |  * <li>The result type might be an {@linkplain jakarta.persistence.Entity entity} class, when  | 
26 | 78 |  *     the query returns an entity:  | 
 | 
0 commit comments