About named queries

1-10 of 200Refresh
Manual
356

JPA Named Queries

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 ... and @NamedQueries Annotations The following @NamedQuery annotation defines a query whose name is "Country.findAll
Manual
183

Query Parameters in JPA [2018-10-20]

execution, because it eliminates the need for repeated query compilations. Named Parameters (:name ... getCountryByName(EntityManager em, String name) { TypedQuery query = em.createQuery( "SELECT c FROM Country c WHERE c.name = :name", Country.class); return query.setParameter
Manual
183

Query Parameters in JPA [2011-04-01]

execution, because it eliminates the need for repeated query compilations. Named Parameters (:name ... getCountryByName(EntityManager em, String name) { TypedQuery query = em.createQuery( "SELECT c FROM Country c WHERE c.name = :name", Country.class); return query.setParameter
Manual
180

Query Parameters in JPA

execution, because it eliminates the need for repeated query compilations. Named Parameters (:name ... getCountryByName(EntityManager em, String name) { TypedQuery query = em.createQuery( "SELECT c FROM Country c WHERE c.name = :name", Country.class); return query.setParameter
Manual
170

JPA Criteria API Queries

. as named queries) may be preferred. For dynamic queries that are built at runtime - the criteria API ... 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
Manual
170

Setting and Tuning of JPA Queries

>        name="javax.persistence.query.timeout" value="3000"/> named query definition - using the hints element: @NamedQuery(name="Country.findAll", query="SELECT c FROM Country c",     hints={@QueryHint(name="javax.persistence.query.timeout", value="7000
Manual
168

Running JPA Queries

printing the country names, a query that uses projection and retrieves country names directly instead ... : Query query = em.createQuery( "SELECT c FROM Country c WHERE c.name = 'Canada ... The Query interface defines two methods for running SELECT queries: Query.getSingleResult - for use
Manual
168

Running JPA Queries [2011-09-21]

printing the country names, a query that uses projection and retrieves country names directly instead ... : Query query = em.createQuery( "SELECT c FROM Country c WHERE c.name = 'Canada ... The Query interface defines two methods for running SELECT queries: Query.getSingleResult - for use
Manual
163

JPA Query API

because it introduces the Country class to ObjectDB. Dynamic JPQL, Criteria API and Named Queries ... for building static queries, as named queries, using the @NamedQuery and @NamedQueries annotations. It is considered to be a good practice in JPA to prefer named queries over dynamic queries when possible
Manual
158

UPDATE SET Queries in JPA/JPQL [2011-11-22]

. 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