Internal Website Search

1-50 of 200 results

Criteria Query Selection and Results

and for representing query results as tuples. SELECT Clause Elements The content of the SELECT ... ;for more details and examples. Query Results as Tuples JPA 2 introduces a new way to represent multi selection results (i.e. results of a query with multiple expressions in the SELECT clause) using

Setting and Tuning of JPA Queries

defining a result window that exposes a portion of a large query result list (hiding ... : List results = query . setFirstResult (pageIx * pageSize) . setMaxResults (pageSize) . getResultList ... on all the result objects that the query retrieves. For example, the following query execution sets

Running JPA Queries

- for use when exactly one result object is expected. Query .getResultList - for general use in any ... : TypedQuery query = em. createQuery ("SELECT c FROM Country c", Country.class); List results = query ... returns a result list of a raw type (non generic) instead of a parameterized (generic) type: Query query

JPA Criteria API Queries

clause. Finally, the range variable, c , is also used in the SELECT clause as the query result ... . createQuery (q); List results = query . getResultList (); Using the criteria API introduces some extra ... ", Country.class); List results = query . getResultList (); Because eventually both types of queries

JPA Query API

should be used mainly when the query result type is unknown or when a query returns polymorphic ... . When a more specific result type is expected queries should usually use the TypedQuery interface. It is easier to run queries and process the query results in a type safe manner when using the TypedQuery interface

JPA Named Queries

rather than embedding literals dynamically into the query string and results in more efficient queries . @NamedQuery ... receives a query name and a result type and returns a TypedQuery instance: TypedQuery query = em. createNamedQuery ("Country.findAll", Country.class); List results = query . getResultList

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 ... ). getSingleResult (); } The WHERE clause reduces the query results to Country objects whose name field value

JPA Query Structure (JPQL / Criteria)

defines the query results . The query above simply returns all the Country objects from the iteration ... 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

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 ...   path expressions - in navigation to persistent date and time fields. as results of predefined ... that are evaluated to the date and time on the database server when the query is executed: CURRENT_DATE

Numbers in JPQL and Criteria Queries

Numeric values may appear in JPQL queries in many forms: as  numeric literals - e.g. 123 ... and JDO. JPA follows Java numeric promotion principles. For example, the resulting type ... the same type the result type is the same. If the two operands have different types, numeric promotion

Strings in JPQL and Criteria Queries

String values may appear in JPQL queries in various forms: as  string literals - e.g. 'abc ... navigation to persistent string fields. as results of predefined JPQL string manipulation functions ... expressions (which are more powerful than the LIKE operator). Criteria Query String Expressions JPQL

SELECT clause (JPQL / Criteria API)

= 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 ... code needed. Notice that query results must always be specified explicitly - JPQL does not support

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  

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

FROM clause (JPQL / Criteria API)

part of any iterated pair and is therefore excluded from the query results . INNER JOIN simply skips any ... could also cause performance problems. For example, let's look at the following query execution and result ... ", Country.class); List results = query . getResultList (); for (Country c : results ) {   

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 .

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)

The ORDER BY clause specifies a required order for the query results . Any JPQL query that does not ... dependent. Query results can also be ordered by multiple order expressions. In this case, the first ... .currency HAVING COUNT(c) 1 ORDER BY c.currency The ORDER BY clause in the above query orders the results by

Database Explorer

range. Check [Disable Cache] to bypass query program and result caches. Click the Execute button ... with the query results , and the size of the result collection and the query execution time are displayed ... for the results . On the bottom of the query window there is a log panel that displays the selected query

ObjectDB Object Database Features

. Query program cache (for repeating queries with different arguments). Query result cache (for repeating ... parameters for efficient reuse of one query in multiple executions. Result range settings (first ... , derived attributes, grouping queries and aggregate queries ) which are usually missing from Object Oriented

GROUP BY and HAVING clauses

The GROUP BY clause enables grouping of query results . A JPQL query with a GROUP BY clause returns ... clause in the query execution order is after the FROM and WHERE clauses, but before the SELECT clause. When a GROUP BY clause exists in a JPQL query , database objects (or tuples of database objects

Database Management Settings

of the two cache mechanisms that ObjectDB manages for queries : The results attribute specifies the size of the query result cache. Caching results is very useful for recurring queries with identical arguments ... still have to be executed, so cached programs are less efficient than cached results . However, cached query

Logical Operators in JPQL and Criteria API

Logical operators in JPQL and in JPA criteria queries enable composition of complex JPQL boolean ... , the JDO Query Language). ObjectDB supports both forms. Binary AND (&&) Operator The following query retrieves countries whose population and area (both) exceed specified limits: SELECT c FROM

WHERE clause (JPQL / Criteria API)

objects to the SELECT clause for collecting as query results , the WHERE clause gets an opportunity ... evaluates to TRUE are passed to the SELECT clause and then collected as query results . WHERE Predicate ... JPQL query that retrieves selective objects from the database. Out of the four optional clauses

JPA Entity Fields

from the inverse query results by specifying a selected key field using the MapKey annotation ... 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

Paths and Types in JPQL and Criteria API

identification variables and SELECT result variables. Parameters - when instances of these classes ... , string, date). Simple type values are more useful in queries . They have special operators ... ). Navigation through a NULL value The following query retrieves country names with their capital city names

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 ... firstName; String lastName; Address address; : } Indexes in Queries ObjectDB manages a BTree

Online Backup

. As a result , the backup query returns a Thread instance that represents the backup run. This thread ... . 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

Deleting JPA Entity Objects

method or implicitly as a result of a cascade operation. Explicit Remove In order to delete ... a remove operation. To avoid dangling references as a result of orphan removal this feature ... to automatic removal of that object from the database. DELETE Queries DELETE queries provide

[ODB1] Chapter 7 - JDOQL Queries

result = (Collection) query .execute(); Queries are represented by the javax.jdo. Query interface. A Query ... (); Collection result = (Collection) query .execute(); The compile() method checks the syntax ... been done so already. The Result Collection The query result is represented by a java.util

Locking in JPA

can also be set for a query in order to lock all the query result objects. When a retrieval operation includes ... update collisions resulting from simultaneous updates to the same data by two concurrent users. Locking ... retrieval operation or query . Releasing a Pessimistic Lock Pessimistic locks are automatically

javax.persistence.Query

is rolled back Since: JPA 1.0 int getFirstResult () The position of the first result the query object ... : position of the first result Since: JPA 2.0 The Running JPA Queries article explains how to use ... int getMaxResults () The maximum number of results the query object was set to retrieve. Returns

Shared (L2) Entity Cache

side: Cache of database file pages . Cache of query programs . Cache of query execution results ... can also be overridden for a specific retrieval operation: // Before executing a query :    query . setHint

JPA Primary Key

in an efficient way. This is especially useful when using queries that return large result sets. As ... and additional details. Suppose that queries that retrieve all the events of a specified sensor in ... primary key can significantly improve query run performance: @Entity public class Event { @EmbeddedId

General Settings and Logging

, such as query results that contain millions of objects. The element specifies temporary file settings ... , which specifies when network sockets become obsolete as a result of inactivity. The value is the timeout

EntityManagerFactory.addNamedQuery(name,query) - JPA Method

, result set mapping information, and information about stored procedure parameters. When the query ... ;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

Step 4: Create an ObjectDB Data Set

) and high ( 20 ): You may click Preview Results  to see the query results : Close the dialog box by ... Queries against the database are represented in BIRT as data sets. To create the data set: Open ... this tutorial contains Point entity objects. We will use a simple JPQL query that retrieves points with x

[ODB1] Chapter 9 - ObjectDB Explorer

with the query results and the size of the result collection and the query execution time ... ). This opens the specified viewer window type and displays the results . On the bottom of the query window ... to browse databases, execute JDOQL queries , create new databases and edit the content of existing

[ODB1] Chapter 6 - Persistent Objects

well using complex, sophisticated queries . The results can also be sorted by specified order expressions ... ( ... ) are never embedded. Objects stored as a result of persistence by reachability can be embedded. By default ... or queried directly (an embedded object can only be retrieved using a reference from its containing

javax.jdo.Query

. There are three required elements in a Query : the class of the results , the candidate collection ... of results , and flags indicating whether the query result is unique and whether the query can be modified ... conflict with parameter names. The result of the query by default is a list of result class instances

[ODB1] Chapter 1 - About ObjectDB

database (for example, as a result of special customer needs or requests) can be done without modifying ... of objects per second. Even queries on millions of objects are very fast, when proper indexes are defined ... with every ObjectDB product, is a sophisticated tool that enables browsing, querying , editing and the construction

Query.setResultClass(cls) - JDO Method

of the query . If the result consists of one expression, the result class defaults to the type ... expression and the second argument is the value from the query result . Portable result classes do not ... JDO Method in javax.jdo. Query void setResultClass (   Class cls ) Specify the type

Query.addSubquery(sub,variableDeclaration,candidateCollectionExpression,parameters) - JDO Method

variableDeclaration - the name of the variable in the outer query to bind the results ... JDO Method in javax.jdo. Query void addSubquery (    Query  sub,     ... ;   String... parameters ) Add a subquery to this query . A subquery is composed as a Query