ObjectDB Database Search
1-50 of 200 resultsJPA Query Structure (JPQL / Criteria) and FROM clauses are mandatory. The FROM clause declares one or more query variables , also known as identification variables . Query variables are similar to loop variables in programming languages. Each query variable represents an iteration over objects in the database. A query variable that is bound | |
JPA Criteria API Queries variable . Finally, the range variable , c , is used in the SELECT clause as the query's result ... The JPA Criteria API provides an alternative way to define JPA queries . It is useful for building dynamic queries whose structure is known only at runtime. JPA Criteria API vs. JPQL JPQL queries | |
DELETE Queries in JPA/JPQL + an optional variable ObjectDB supports using the java.lang.Object class in queries as an extension ... operation. Apply changes to the database by calling the commit method. JPQL DELETE queries provide an alternative way to delete entities. Unlike SELECT queries , which retrieve data from the database | |
UPDATE SET Queries in JPA/JPQL. Apply the changes to the database by calling the commit method. JPQL UPDATE queries provide an alternative way to update entities. Unlike SELECT queries , which retrieve data, UPDATE queries modify specified entities directly in the database without retrieving them first. Using an UPDATE query | |
FROM clause (JPQL / Criteria API) The FROM clause declares query identification variables for iterating over objects in the database. A query identification variable is similar to a variable in a Java enhanced for loop because both are used to iterate over objects. Range variables Range variables are query identification variables | |
JPA Query Expressions (JPQL / Criteria) Criteria API expressions. Atomic expressions The atomic query expressions are: JPQL / Criteria Variables JPQL / Criteria Parameters JPQL / Criteria Literals Every query expression consists ... JPQL and criteria queries are built on query expressions. Every query consists of clauses | |
Paths and Types in JPQL and Criteria API variables ) is skipped. To better understand how this works, consider the equivalent JOIN query ... using the get method: // FROM Variable Paths: Root country = query . from (Country.class); Join ... modifies the query by adding a variable to the FROM clause, which represents iteration during query | |
JPA Criteria FROM and JOIN clause of a query . These interfaces define query variables , including entity roots and various join types ... ; Criteria query variables The FORM clause in queries defines query variables , which act as loop variables for iterating over data in the database that may be relevant to the query results. Query | |
Setting and Tuning of JPA Queries The Query and TypedQuery interfaces define various methods for setting and tuning query execution . To take effect, you must invoke these methods before running a query with getResultList or ... let you define a result window, which is a portion of a large query result list. The setFirstResult | |
Query Parameters in JPA Query parameters enable you to define reusable queries . You can execute these queries with different parameter values to retrieve different results. Executing the same query multiple times with different parameter values is more efficient than using a new query string for each execution | |
Running JPA Queries The Query interface defines two methods for running SELECT queries : Query .getSingleResult () : Use when exactly one result object is expected. Query .getResultList () : Use in any other case ... addition, the Query interface defines a method for running DELETE and UPDATE queries : Query | |
JPA Named Queries A named query is a statically defined query with a predefined, unchangeable query string. Using named queries instead of dynamic queries can improve code organization by separating JPQL query strings from Java code. This practice also enforces the use of query parameters instead of embedding | |
JPA JPQL WHERE clause for IN :variable not working if variable is a list of Enums Hi, I have a case where I have a JPQL query like: "select o from MyEntity o WHERE (enumField IN ... ; query .setParameter("enumFieldList", Arrays.asList(MyEnumType.VALUE1, MyEnumType.VALUE2)); Then query .getResultSet() *always* returns an empty list | |
JPA Query API Jakarta Persistence (JPA) represents queries with two interfaces: the Query interface, which was the only query interface in JPA 1, and the TypedQuery interface, which was introduced in JPA 2. The TypedQuery interface extends the Query interface. Use the Query interface primarily when the query | |
JPA Queries Jakarta Persistence provides powerful APIs for executing database queries using JPQL strings or the programmatic Criteria API. These interfaces support both static and dynamic query construction with full type safety. General query objects Execute SELECT, UPDATE and DELETE queries in JPA using | |
JPA Criteria Queries to string-based JPQL for constructing dynamic queries , ensuring compile-time safety and facilitating ... queries : Criteria Queries Hierarchy in Jakarta Persistence (JPA) 3.2 Instances of  ... of CriteriaBuilder as mutable empty objects, and then defined using setter methods. All query types (SELECT | |
WHERE clause (JPQL / Criteria API)- variable queries In a multi- variable query , the FROM clause defines an iteration over tuples. In ... . In multi- variable queries , the number of tuples for iteration can be very large even if the database ... for retrieving a specific subset of objects from the database. How a WHERE clause works The following query | |
JPA Criteria Query Expressions Jakarta Persistence (JPA) Criteria API uses a hierarchy of interfaces to model query conditions and selections, enabling the construction of dynamic, type-safe queries . These interfaces represent the building blocks for defining query logic programmatically. The hierarchy of the expression | |
JPA Named Queries Annotations Jakarta Persistence (JPA) provides annotations to define static, reusable queries at the class level, separating query logic from business code. Query definitions Declare named queries using the following annotations: Specifies a static, named query in the Jakarta Persistence Query Language (JPQL | |
Chapter 4 - JPA Queries (JPQL / Criteria) The Jakarta Persistence Query Language (JPQL) is an object-oriented version of SQL. Users familiar ... and the Jakarta Persistence (JPA) Criteria Query API, which provides an alternative way to build queries in JPA. The first section describes the JPA API for running dynamic and static (named) queries | |
JPA Runtime Tuning & Configuration dynamic options that control runtime behavior and allow you to adjust settings per session, query , or ... every operation in that session. Query (definition): Settings applied to a Query object override session defaults for that query . Operation (argument): Settings passed to specific EntityManager operations ( find | |
SQL Queries Annotations Jakarta Persistence (JPA) provides a set of annotations to define and map native SQL queries when the standard Java Persistence Query Language (JPQL) is insufficient. While ObjectDB focuses on JPQL ... databases through specific SQL dialects. Native query definitions Define raw SQL queries using | |
Strings in JPQL and Criteria Queries String values can appear in JPQL queries in several forms: As string literals , for example, 'abc' and '' . As parameters when string values are passed as query arguments. As path expressions ... . Criteria query string expressions Query String Expressions The JPQL string operators and functions | |
Date and Time in JPQL and Criteria Queries Date and time expressions can appear in JPQL queries in the following ways: As date and time ... when the query is executed: CURRENT_DATE : Returns the current date as a java.sql.Date instance. CURRENT_TIME ... . Date and time in criteria queries The CriteriaBuilder interface provides three factory methods | |
JPA Criteria Query Selection and Results The JPA Criteria API provides type-safe interfaces for defining query result expressions ... a single query result (result set row) and provides methods for obtaining the elements of  ... class). For more information, see the SELECT in Criteria Queries section. ORDER BY clause elements | |
Collections in JPQL and Criteria Queries Collections can appear in JPQL queries in the following ways: As parameters when a collection ... to check other collections, such as a collection passed as a query parameter. For example: 'English' IN ... are synonyms. Criteria query collection expressions The JPQL collection operators and functions | |
Literals in JPQL and Criteria Queries type literals (for example, Country ). Use JPQL literals sparingly. Queries that use parameters ... times with different parameter values. Embed literals in JPQL queries only when a single, constant ... '} . For example: {ts '2020-01-03 13:59:59'} Enum literals Enum literals in JPQL queries use the standard Java | |
Numbers in JPQL and Criteria Queries Numeric values can appear in JPQL queries in several forms: As numeric literals , such as 123 ... type and always returns a double value. Criteria query arithmetic expressions JPQL arithmetic operators and functions (which are described above) are available also as JPA criteria query expressions | |
SELECT clause (JPQL / Criteria API) query returns Country objects, which then become managed by the EntityManager instance em : TypedQuery query = em. createQuery ("SELECT c FROM Country c", Country.class); List results = query ... for deletion , and so on. Query results are not limited to entities. You can use almost any valid JPQL | |
JPA Criteria Query Date/Time Extraction Jakarta Persistence criteria queries use the following interfaces and enums to extract temporal components like year, month, or hour from date and time values. TemporalField # Base interface ... a criteria query specify the enum value that represents that component as the first argument of  | |
GROUP BY and HAVING clauses The GROUP BY clause groups query results. A JPQL query with a GROUP BY clause returns properties of the resulting groups instead of individual objects and fields. In the query execution order ... . When a query includes a GROUP BY clause, the database objects (or tuples) that result from the FROM clause | |
ORDER BY clause (JPQL / Criteria API) The ORDER BY clause specifies the order for the query results. Any JPQL query that does not ... expressions The following query returns the names of countries with a population of at least one million ... If a query includes an ORDER BY clause, it is the last clause to be executed. The FROM clause first | |
JPA Persistable Types no-argument constructor. Must not be final and must not have final methods or final instance variables ... classes are not. Instance (non-static) variables cannot be `final`, but classes and methods ... are represented in queries by entity names . By default, the entity name is the unqualified name | |
Logical Operators in JPQL and Criteria API Logical operators in JPQL and JPA criteria queries combine simple Boolean expressions to form ... , while Java uses its own notation, which is also used by the JDO Query Language (JDOQL). ObjectDB supports both notations. Binary AND (&&) operator The following query retrieves countries whose population | |
JPA Metamodel and Graphs objects that can be bound to a Path in a Criteria query , mainly to define FROM variables ... , and their attributes to build dynamic queries and validate persistence structures. The Metamodel Access ... and further explanation, refer to the JPA Metamodel API section in the ObjectDB manual. Criteria query | |
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 | |
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 | |
OutOfMemoryError in a query with many variables. Can you post the query ? Does it have a large number of variables ( 20) ? support Support Hi, Yes ... doesn't handle well queries with a lot of variables , and complex navigation (e.g. $1.postalAddresses ... the limitation on the number of variables in a query . support Support | |
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 |