Internal Website Search
1-50 of 200 resultsJPA 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 | |
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", 6000); For a named query definition - using the hints element: @NamedQuery ( name ="Country.findAll", query ="SELECT c FROM Country c", hints ={@ QueryHint ( name ... The Query and TypedQuery interfaces define various setting and tuning methods | |
Running JPA Queries, a query using projection and retrieving country names directly instead of retrieving the entire ... ( "SELECT c FROM Country c WHERE c. name = 'Canada'"); Country c = (Country) query . getSingleResult ... 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 | |
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 | |
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 . | |
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 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   | |
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 | |
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 | |
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 | |
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 | |
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. | |
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 | |
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 | |
EntityManagerFactory.addNamedQuery(name,query) - JPA Method; 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 the createNamedQuery ... parameter binding) in effect when the named query is added is retained as part of the named query | |
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 | |
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 | |
Query.getParameter(name,type) - JPA Method JPA Method in javax.persistence. Query Parameter getParameter ( String name ,  ... of the given name and type. This method is required to be supported for criteria queries only. Parameters: name - parameter name type - type Return: parameter object Throws: IllegalArgumentException | |
Query.setParameter(name,value,temporalType) - JPA Method JPA Method in javax.persistence. Query Query setParameter ( String name ,  ... - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect type Since: JPA 1.0 ... of java.util.Calendar to a named parameter. Parameters: name - parameter name value - parameter | |
Query.setParameter(name,value) - JPA Method JPA Method in javax.persistence. Query Query setParameter ( String name ,  ... - parameter name value - parameter value Return: 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: JPA 1.0 | |
Query.setParameter(name,value,temporalType) - JPA Method JPA Method in javax.persistence. Query Query setParameter ( String name ,  ... - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect type Since: JPA 1.0 ... of java.util.Date to a named parameter. Parameters: name - parameter name value - parameter value | |
Query.getParameter(name) - JPA Method JPA Method in javax.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 Return: parameter | |
Query.getParameterValue(name) - JPA Method JPA Method in javax.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 Return: parameter value Throws: IllegalStateException - if the parameter | |
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 | |
Database Connection using JPA for Query instances, which are needed for executing queries on the database. Every JPA implementation ... an argument a name of a persistence unit . As an extension, ObjectDB enables specifying a database URL (or ... a persistence unit name . To use ObjectDB embedded directly in your application (embedded mode | |
Index Definition Querying without indexes requires iteration over entity objects in the database one by ... indexes the iteration can be avoided and complex queries over millions of objects can be executed quickly ... indexedField2; // unique @Index ( name ="i3") int indexedField3; @Unique Integer indexedField4 | |
Comparison in JPQL and Criteria API Most JPQL queries use at least one comparison operator in their WHERE clause. Comparison Operators ... its own notation (which is also in use by JDOQL, the JDO Query Language). ObjectDB supports both forms ... . Equality operators (=, , == , != ) on strings in queries follow the logic of Java's equals | |
Online Backup. Starting Online Backup The online backup can be started by executing a special query on an EntityManager ... ; em.createQuery("objectdb backup").getSingleResult(); The backup query string is always exactly ... mode a subdirectory of the ObjectDB home directory on the server side). A new subdirectory with a name | |
Posting Sample Code.getTransaction().commit(); Query query = em.createQuery("SELECT e FROM MyEntity e"); List resultList = query ... { private String name ;   | |
[ODB1] Chapter 7 - JDOQL Queries when the query is executed. Class Person must have a persistent field with the name birthDate and type Date ... . When a more selective retrieval is needed, JDOQL (JDO Query Language) is used. JDOQL for JDO is like ... a specified order. 7.1 Introduction to JDOQL A basic JDOQL query has the following | |
[ODB1] Chapter 6 - Persistent Objects the assignment of names to objects in the database and the storing of instances of any persistent type ... or queried directly (an embedded object can only be retrieved using a reference from its containing object). 6.2 Object IDs and Names Identifying database objects by unique IDs and by names | |
[ODB1] Chapter 4 - JDO Metadata is the package name , X is the class name ), whose class file is a/b/X.class , is searched in ... with the name X.jdo must be dedicated to a single class whose name is X . Metadata for multiple ... elements. Both and elements have a required name attribute. The metadata above defines class A (in | |
[ODB1] Chapter 9 - ObjectDB Explorer to browse databases, execute JDOQL queries , create new databases and edit the content of existing ... objects visually, navigate among them and execute queries is very valuable during development ... that the database contains (root objects are discussed in chapter 6 ). The " Query " window enables a user to execute | |
javax.jdo.annotations.Query.name JDO Annotation Attribute in javax.jdo.annotations. Query String name default null Name of the query (mandatory) Since: JDO 2.1 | |
[ODB1] Chapter 5 - JDO Connections PersistenceManagerFactory is specified using a Properties instance. Each property consists of two strings, a name ... .objectdb.jdo.PMF" (the name of ObjectDB's class that implements the PersistenceManagerFactory interface ... =com.objectdb.jdo.PMF javax.jdo.option.ConnectionURL=local.odb Assuming the name of the file is jdo |