 197 | A named query is a statically defined query with a predefined unchangeable query string. Using named queries instead of dynamic queries may improve code organization by separating the JPQL query strings from the Java code. It also enforces the use of query parameters rather than embedding literals |
 194 | The JPA Criteria API provides an alternative way for defining JPA queries, which is mainly useful for building dynamic queries whose exact structure is only known at runtime. JPA Criteria API vs JPQL JPQL queries are defined as strings, similarly to SQL. JPA criteria queries, on the other hand |
 189 | The Query and TypedQuery interfaces define various setting and tuning methods that may affect query execution if invoked before a query is run using getResultList or getSingleResult. Result Range ... window that exposes a portion of a large query result list (hiding anything outside that window |
 188 | Query parameters enable the definition of reusable queries. Such queries can be executed with different parameter values to retrieve different results. Running the same query multiple times with different parameter values (arguments) is more efficient than using a new query string for every query |
 184 | The Query interface defines two methods for running SELECT queries: Query.getSingleResult - for use when exactly one result object is expected. Query.getResultList - for general use in any other case ... other case. In addition, the Query interface defines a method for running DELETE and UPDATE queries |
 176 | Queries are represented in JPA 2 by two interfaces - the old Query interface, which was the only interface available for representing queries in JPA 1, and the new TypedQuery interface that was introduced in JPA 2. The TypedQuery interface extends the Query interface. In JPA 2 the Query interface |
 172 | Queries are represented in JPA by the Query and TypedQuery interfaces: The JPA Query API section ... these interfaces to build and run JPQL queries. The TypedQuery interface (or alternatively the older Query interface) is the only neccessary interface for defining and running string based JPQL queries (e.g |
 170 | . Applying changes to the database by calling the commit method. JPQL DELETE queries provide an alternative way for deleting entity objects. Unlike SELECT queries, which are used to retrieve data from the database, DELETE queries do not retrieve data from the database, but when executed, delete specified |
 170 | The syntax of the Java Persistence Query Language (JPQL) is very similar to the syntax of SQL. Having a SQL like syntax in JPA queries is an important advantage because SQL is a very powerful query ... classes and objects. For example, a JPQL query can retrieve and return entity objects |
 169 | . Applying changes to the database by calling the commit method. JPQL UPDATE queries provide an alternative way for updating entity objects. Unlike SELECT queries, which are used to retrieve data from the database, UPDATE queries do not retrieve data from the database, but when executed, update |