Home » Search

About named queries

1-10 of 200Refresh
Manual
242

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
153

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
130

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
110

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
110

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
107

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
96

UPDATE SET Queries in JPA/JPQL

. 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
Manual
95

JPA Query Structure (JPQL / Criteria)

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
Manual
91

Literals in JPQL and Criteria Queries

specifying another name explicitly in the @Entity's name annotation element. Criteria Query Literals ... literals should be used sparingly as queries that use parameters instead of literals ... values. Literals should only be embedded in JPQL queries when a single constant value is always used
Manual
89

Chapter 4 - JPA Queries (JPQL / Criteria)

(named) queries. It explains how to use the relevant interfaces, annotations, enums and methods ... The JPA Query Language (JPQL) can be considered as an object oriented version of SQL. Users ... well as how to use the JPA Criteria API, which provides an alternative way for building queries in JPA