ObjectDB Database Search

1-50 of 200 results

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 ... : @NamedQuery ( name ="Country.findAll", query ="SELECT c FROM Country c") The  @NamedQuery annotation

JPA Named Queries Annotations

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 ... , cache usage, or fetch graphs. For details and examples, see the JPA Named Queries section

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 (" name ", name

JPA Criteria API Queries

queries (e.g. as named queries ) may be preferred. For dynamic queries that are built at runtime -  ... 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

Setting and Tuning of JPA Queries

.timeout", 6000); For a  named query definition - using the hints  element: @NamedQuery ( name ... ( name ="jakarta.persistence. query .timeout",     value="7000")}) For a specific ... The  Query and  TypedQuery interfaces define various setting and tuning methods

Running JPA Queries

the country names , a query using projection and retrieving country names directly instead ... = em. createQuery ( "SELECT c FROM Country c WHERE c. name = 'Canada'"); Country c = (Country) query ... The Query interface defines two methods for running SELECT queries : Query .getSingleResult

JPA Query API

and Named Queries Building queries by passing JPQL query strings directly to the createQuery method, as ... also provides a way 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

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

JPA Queries

to ObjectDB). Interface for declaring and handling named or positional query parameters. Use ... 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

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

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

Strings in JPQL and Criteria Queries

String values may appear in JPQL queries in various forms: as  string literals - e.g. 'abc ... (usually a parameter or literal). For example: c. name LIKE '_r%' is TRUE for 'Brazil' and FALSE for 'Denmark' c. name LIKE '%' is always TRUE (for any c. name value). c. name NOT LIKE '%' is always FALSE

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

SQL Queries Annotations

the following annotations: Specifies a named native SQL query using the underlying database's specific SQL ... 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

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

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

SELECT clause (JPQL / Criteria API)

path expressions , such as c. name , in query results is referred to as projection. The field values ... c. name FROM Country AS c", String.class); List results = query . getResultList (); Only singular ... query retrieves the name of the capital city of a specified country: SELECT c.capital. name FROM

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

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

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

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

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 

jakarta.persistence.Query

is not required to be supported for native queries . Parameters: name - parameter name Returns: parameter ... is required to be supported for criteria queries only. Parameters: name - parameter name type - type ... Query setParameter ( String name , Object value ) Bind an argument value to a named parameter

FROM clause (JPQL / Criteria API)

, and the same query can also be written as follows: SELECT c FROM Country c By default, the name of an entity class in a JPQL query is the unqualified name of the class (e.g. just Country with no package ... name annotation element. Multiple range variables are allowed. For example, the following query

jakarta.persistence.Entity.name

Jakarta Persistence (JPA) Method in jakarta.persistence.Entity String name (Optional) The entity name . Defaults to the unqualified name of the entity class. This name is used to refer to the entity in queries . The name must not be a reserved literal in the Jakarta Persistence query language. Default: "" Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.NamedStoredProcedureQuery.name

Jakarta Persistence (JPA) Method in jakarta.persistence.NamedStoredProcedureQuery String name The name used to refer to the query with the EntityManager methods that create stored procedure query objects. Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.NamedNativeQuery.name

Jakarta Persistence (JPA) Method in jakarta.persistence.NamedNativeQuery String name The name used to identify the query in calls to EntityManager.createNamedQuery . Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.NamedQuery.name

Jakarta Persistence (JPA) Method in jakarta.persistence.NamedQuery String name (Required) The name used to identify the query in calls to EntityManager.createNamedQuery . Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.SqlResultSetMapping.name

Jakarta Persistence (JPA) Method in jakarta.persistence.SqlResultSetMapping String name The name given to the result set mapping, and used to refer to it in the methods of the Query and StoredProcedureQuery APIs. Since: Jakarta Persistence (JPA) 1.0

jakarta.persistence.ColumnResult.name

Jakarta Persistence (JPA) Method in jakarta.persistence.ColumnResult String name (Required) The name of a column in the SELECT clause of a SQL query Since: Jakarta Persistence (JPA) 1.0

ORDER BY clause (JPQL / Criteria API)

Expressions The following query returns names of countries whose population size ... BY c. name DESC Grouping (GROUP BY) Order The ORDER BY clause is always the last in the query ... The ORDER BY clause specifies a required order for the query results. Any JPQL query that does not

GROUP BY and HAVING clauses

(which does not use aggregates) is equivalent to the following query : SELECT DISTINCT SUBSTRING(c. name , 1 ... (numeric, strings, dates). The following query counts for every letter the number of countries with names ... SUBSTRING(c. name , 1, 1); The query returns Object[] arrays of length 3, in which the first cell contains

Paths and Types in JPQL and Criteria API

). Navigation through a NULL value The following query retrieves country names with their capital city names ... , string, date). Simple type values are more useful in queries . They have special operators ... . For example, c.capital. name is a nested path expression that continues from the Capital entity object

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

JPA Persistable Types

, package or private) and it can be either concrete or abstract. Entity Class Names Entity classes are represented in queries by entity names . By default, the entity name is the unqualified name of the entity class (i.e. the short class name excluding the package name ). A different entity name

JPA Entity Fields

of the following query : SELECT e FROM Employee e WHERE e.department = :d ORDER BY e. name The specified field ... after retrieval by a special automatic query . Note : Navigation through inverse fields is much less efficient than navigation through ordinary persistent fields, since it requires running queries . Inverse

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

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Parameter getParameter (    String name ,    Class type ) Get the parameter object corresponding to the declared parameter of the given name and type. This method is required to be supported for criteria queries

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

- if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect ... Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    String name ,    Calendar value ,    TemporalType temporalType ) Bind an instance

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

name does not correspond to a parameter of the query or if the value argument is of incorrect type ... Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (    String name ,    Date value ,    TemporalType temporalType ) Bind an instance

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

: name - parameter name 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 argument is of incorrect type. Since: Jakarta Persistence (JPA) 1.0 ... Jakarta Persistence (JPA) Method in jakarta.persistence. Query Query setParameter (   

jakarta.persistence.Query.getParameter(String)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Parameter getParameter (    String name ) Get the parameter object corresponding to the declared parameter of the given name . This method is not required to be supported for native queries . Parameters: name - parameter name

jakarta.persistence.StoredProcedureQuery

: IllegalArgumentException - if the parameter name does not correspond to a parameter of the query or is not ... required to be supported for native queries . Inherited from Query Parameters: name - parameter name ... parameter. (Note that OUT parameters are unbound.) Inherited from Query Parameters: name - parameter

ObjectDB Object Database Features

Criteria Query API . Static definition ( named queries ) in annotations (@NamedQuery) and XML. Query ... , derived attributes, grouping queries and aggregate queries ) which are usually missing from Object Oriented ... . Query program cache (for repeating queries with different arguments). Query result cache (for repeating

Database Explorer

to view data in ObjectDB databases, execute JPQL and JDOQL queries and edit the content of databases ... and embeddable classes) in the database and their persistent fields and indexes. The [ Query ] window enables running JPQL and JDOQL queries , as discussed below. Closing a Database Connection Use the File Close

jakarta.persistence.Query.getParameterValue(String)

Jakarta Persistence (JPA) Method in jakarta.persistence. Query Object getParameterValue (    String name ) Return the input value bound to the named parameter. (Note that OUT parameters are unbound.) Parameters: name - parameter name Returns: parameter value. Throws: IllegalStateException

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.TypedQuery

of the given name . This method is not required to be supported for native queries . Inherited from Query Parameters: name - parameter name Returns: parameter object. Throws: IllegalStateException ... parameter of the given name and type. This method is required to be supported for criteria queries

Database Management Settings

when the database is closed. The name of the recovery file is based on the name of the database file ... (which modify the database) have to be recorded. For debugging of query failure ... to accelerate the execution of relevant queries . The element The element specifies settings