ObjectDB Database Search

1-50 of 200 results

JPA Criteria API Queries

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

Setting and Tuning of JPA Queries

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 ... defining a result window that exposes a portion of a large query result list (hiding

Query Parameters in JPA

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

Running JPA Queries

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 ... - for general use in any other case. In addition, the Query interface defines a method for running

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 strings from the Java code. It also enforces the use of query   parameters

JPA Query API

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

JPA Queries

Queries are represented in JPA by the Query and TypedQuery interfaces: The JPA Query API ... 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  

JPA Query Structure (JPQL / Criteria)

The syntax of the Java Persistence Query Language (JPQL) is very similar to the syntax of SQL. Having an 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

DELETE Queries in JPA/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 ... from the database using a DELETE query may be slightly more efficient than retrieving entity objects

UPDATE SET Queries in JPA/JPQL

;within an active transaction. Applying changes to the database by calling the commit method. JPQL UPDATE queries provide an alternative way of updating entity objects. Unlike SELECT queries , which are used to retrieve data from the database, UPDATE queries do not retrieve data from the database

JPA Query Expressions (JPQL / Criteria)

Query expressions are the foundations on which JPQL and criteria queries are built. Every query ... of JPQL / Criteria query expressions. Atomic Expressions The atomic query expressions are: JPQL / Criteria Variables JPQL / Criteria Parameters JPQL / Criteria Literals Every query expression consists

Chapter 4 - JPA Queries (JPQL / Criteria)

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 ... (named) queries . It explains how to use the relevant interfaces, annotations, enums and methods

Criteria Query Selection and Results

and for representing query results as tuples. SELECT Clause Elements The content of the SELECT clause in a criteria query is represented by Selection : Because Selection  is a super interface ... of Selection : See the SELECT in Criteria Queries section for more details and examples. ORDER BY

Criteria Query From Elements

The interfaces in this group are in use for setting a criteria query FROM clause. Criteria Query Variables The FROM clause  in JPA queries (as in SQL) defines the query variables. Query variables are represented in criteria queries by descendant interfaces of the From interface: Range

Date and Time in JPQL and Criteria Queries

Date and time expressions may appear in JPQL queries : as date and time literals - e.g. {d '2011-12 ... that are evaluated to the date and time on the database server when the query is executed: CURRENT_DATE ... to 0 . Date and Time in Criteria Queries The CriteriaBuilder interface provides three factory methods

Collections in JPQL and Criteria Queries

Collections may appear in JPQL queries : as parameters - when collections are assigned as arguments ... that is passed to the query as a parameter. For example: 'English' IN :languages is TRUE if the argument ... are treated as synonyms. Criteria Query Collection Expressions JPQL collection operators and functions

Literals in JPQL and Criteria Queries

). JPQL literals should be used sparingly as queries that use parameters instead of literals ... parameter values. Literals should only be embedded in JPQL queries when a single constant value ... '} Enum Literals JPA 2 adds support for enum literals. Enum literals in JPQL queries use

JPA Annotations for JPQL Queries

The following annotations are used to define static named JPA queries : The JPA Named Queries section of the ObjectDB Manual explains and demonstrates how to use these annotations to define named JPQL queries .

Strings in JPQL and Criteria Queries

String values may appear in JPQL queries in various forms: as  string literals - e.g. 'abc ... expressions (which are more powerful than the LIKE operator). Criteria Query String Expressions JPQL string operators and functions (which are described above) are available also as JPA criteria query

Numbers in JPQL and Criteria Queries

Numeric values may appear in JPQL queries in many forms: as  numeric literals - e.g. 123 ... . Criteria Query Arithmetic Expressions JPQL arithmetic operators and functions (which are described above) are available also as JPA criteria query expressions. The CriteriaBuilder interface provides

Criteria Query Expressions

The following interfaces are in use in representing general expressions in criteria queries : See the Query Expressions section for more details and examples.

JPA Annotations for SQL Queries

The following JPA annotations are designated for SQL queries on relational databases: ObjectDB supports only the preferred JPA query language, JPQL, and silently ignores all the above annotations.

jakarta.persistence.Query

Jakarta Persistence (JPA) Interface jakarta.persistence. Query Interface used to control query ... Chapter 4 - JPA Queries (JPQL / Criteria) explains how to use Query . Public Instance Methods int ... . Throws: IllegalStateException - if called for a Jakarta Persistence query language SELECT

SELECT clause (JPQL / Criteria API)

, the following query returns Country objects that become managed by the EntityManager em : TypedQuery query = em. createQuery ("SELECT c FROM Country c", Country.class); List results = query . getResultList ... detection , support for delete , etc. Query results are not limited to entity objects. JPA 2 adds

FROM clause (JPQL / Criteria API)

The FROM clause declares query identification variables that represent iteration over objects in the database. A query identification variable is similar to a variable of a Java enhanced for loop in ... are query identification variables that iterate over all the database objects of a specific entity

jakarta.persistence.EntityManagerFactory.addNamedQuery(String,Query)

(    String name ,    Query query ) Define the query , typed query , or stored procedure query as a named query such that future query objects can be created from it using ... of the query object (except for actual parameter binding) in effect when the named query is added

jakarta.persistence.Query.setLockMode(LockModeType)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setLockMode (    LockModeType lockMode ) Set the lock mode type to be used for the query execution. Parameters: lockMode - lock mode Returns: the same query instance. Throws: IllegalStateException - if the query is found

jakarta.persistence.Query.getResultList()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query List getResultList() Execute a SELECT query and return the query results as an untyped List . Returns: a list of the results, or ... query language UPDATE or DELETE statement. PessimisticLockException - if pessimistic locking fails

jakarta.persistence.Query.getResultStream()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Stream getResultStream() Execute a SELECT query and return the query results as an untyped Stream . By default, this method delegates ... if there are no results. Throws: IllegalStateException - if called for a Jakarta Persistence query language UPDATE or

jakarta.persistence.Query.getLockMode()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query LockModeType getLockMode() Get the current lock mode for the query . Returns null if a lock mode has not been set on the query object. Returns: lock mode. Throws: IllegalStateException - if the query is found not to be a Jakarta

jakarta.persistence.Query.getSingleResultOrNull()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Object getSingleResultOrNull() Execute a SELECT query that returns a single untyped result. Returns: the result, or null if there is no result. Throws: IllegalStateException - if called for a Jakarta Persistence query language UPDATE or

jakarta.persistence.Query.getSingleResult()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Object getSingleResult() Execute a SELECT query that returns a single untyped result. Returns: the result. Throws: IllegalStateException - if called for a Jakarta Persistence query language UPDATE or DELETE statement

jakarta.persistence.Query.executeUpdate()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query int executeUpdate() Execute ... : IllegalStateException - if called for a Jakarta Persistence query language SELECT statement or for a criteria query . PersistenceException - if the query execution exceeds the query timeout value set

jakarta.persistence.QueryTimeoutException.QueryTimeoutException(Query)

Jakarta Persistence (JPA) Constructor in jakarta.persistence.QueryTimeoutException QueryTimeoutException (    Query query ) Constructs a new QueryTimeoutException exception with the specified query . Parameters: query - the query . Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.QueryTimeoutException.QueryTimeoutException(String,Throwable,Query)

QueryTimeoutException (    String message ,    Throwable cause ,    Query query ) Constructs a new QueryTimeoutException exception with the specified detail message, cause, and query . Parameters: cause - the cause. message - the detail message. query - the query . Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.Query.getParameters()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Set getParameters() Get the parameter objects corresponding to the declared parameters of the query . Returns empty set if the query has no parameters. This method is not required to be supported for native queries . Returns: set

jakarta.persistence.Query.getParameter(String,Class)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Parameter getParameter (    ... parameter of the given name and type. This method is required to be supported for criteria queries ... : IllegalStateException - if invoked on a native query or Jakarta Persistence query language query

jakarta.persistence.Query.setFlushMode(FlushModeType)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setFlushMode (    FlushModeType flushMode ) Set the flush mode type to be used for the query execution. The flush mode type applies to the query regardless of the flush mode type in use for the entity manager. Parameters

jakarta.persistence.Query.setTimeout(Integer)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setTimeout (    Integer timeout ) Set the query timeout, in milliseconds. This is a hint, and is an alternative to setting the hint jakarta.persistence. query .timeout . Parameters: timeout - the timeout, in milliseconds

jakarta.persistence.Query.setHint(String,Object)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setHint (    String hintName ,    Object value ) Set a query property or hint. The hints elements may be used to specify query properties and hints. Properties defined by this specification must be observed by

jakarta.persistence.Query.setParameter(int,Date,TemporalType)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    ... - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if position does not correspond to a positional parameter of the query or if the value argument is of incorrect

jakarta.persistence.Query.setParameter(String,Calendar,TemporalType)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    ... value - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect

jakarta.persistence.Query.setParameter(String,Date,TemporalType)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    ... - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect type

jakarta.persistence.Query.setParameter(int,Object)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    ... . Parameters: position - position value - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if position does not correspond to a positional parameter of the query or

jakarta.persistence.Query.setParameter(int,Calendar,TemporalType)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    ... value - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if position does not correspond to a positional parameter of the query or if the value argument

jakarta.persistence.Query.getParameter(int,Class)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Parameter getParameter (    int position ,    Class type ) Get the parameter object corresponding to the declared ... : IllegalStateException - if invoked on a native query or Jakarta Persistence query language query

jakarta.persistence.Query.setCacheRetrieveMode(CacheRetrieveMode)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setCacheRetrieveMode (   ... during query execution. This cache retrieval mode overrides the cache retrieve mode in use by the entity manager. Parameters: cacheRetrieveMode - cache retrieval mode Returns: the same query instance. Since: Jakarta Persistence (JPA) 3.2

jakarta.persistence.Query.setCacheStoreMode(CacheStoreMode)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setCacheStoreMode (    CacheStoreMode cacheStoreMode ) Set the cache storage mode that is in effect during query ... . Parameters: cacheStoreMode - cache storage mode Returns: the same query instance. Since: Jakarta Persistence (JPA) 3.2

jakarta.persistence.Query.getMaxResults()

Jakarta Persistence (JPA) Method in jakarta.persistence. Query int getMaxResults() The maximum number of results the query object was set to retrieve. Returns Integer.java.lang.Integer/MAX_VALUE if Query .setMaxResults was not applied to the query object. Returns: maximum number of results. Since: Jakarta Persistence (JPA) 2.0

jakarta.persistence.Query.setParameter(Parameter,T)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    ... - parameter object value - parameter value Returns: the same query instance. Throws: IllegalArgumentException - if the parameter does not correspond to a parameter of the query . Since: Jakarta Persistence (JPA) 2.0