About ORDER BY
ORDER BY clause (JPQL / Criteria API)
Explains how to use the ORDER BY clause in a JPA/JPQL query. The ORDER BY clause specifies a required order for the query results. Any JPQL query that does not include an ORDER BY clause produces results in an undefined and non-deterministic order. This page covers the following topics: ...
Criteria Query Selection and Results
Reference (JavaDoc) of JPA query criteria result interfaces, including Selection, CompoundSelection, Order and Tuple. The JPA Criteria API interfaces in this group are in use for setting the SELECT and ORDER BY clauses and for representing query results as tuples. SELECT Clause Elements The content of the SELECT clause in a criteria query is represen ...
JPA Query Structure (JPQL / Criteria)
Explains the structure of a JPQL query, which consists of 6 clauses: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY. The syntax of the Java Persistence Query Language (JPQL) is very similar to the syntax of SQL. Having a SQL like syntax in JPA queries is an important advantage because SQL is a very powerful query language and many developers are already familiar wi ...
JPA vs JDO - which is more efficient for OneToMany queries?
I'm curious about the trade offs between JDO and JPA. Seems to me that JDO will perform better and be statically typed. For example: Assume there are Customers and Orders. #1 2010-11-09 12:04 I'm curious about the trade offs between JDO and JPA. Seems to me that JDO will perform better and be statically ...
Chapter 4 - JPA Queries (JPQL / Criteria)
Describes the Java Persistence Query Language (JPQL), the JPA Criteria API, and explains how to use queries in JPA. The JPA Query Language (JPQL) can be considered as an object oriented version of SQL. Users familiar with SQL should find JPQL very easy to learn and use. This chapter explains how to use JPQL as well as how to use the JPA Criteria API, which provide ...
GROUP BY and HAVING clauses
Explains how to use the GROUP BY and HAVING clauses in a JPA/JPQL query. The GROUP BY clause enables grouping of query results. A JPQL query with a GROUP BY clause returns properties of generated groups instead of individual objects and fields. The position of a GROUP BY clause in the query execution order is afte ...
Problem with @OrderBy
When I use @OrderBy and supply multiple order fields I get and error when ObjectDB loads that entity. Example code: @Entity @Table(name="Problems", schema = myDB") public class Defects implements Serializable { ... ... @OneToMany(mappedBy="problem") @OrderBy("seqRel, noteSeq") Set<Notes> notes; ... ... } #1 2011-04-21 05:17 When I use @OrderBy and supply multiple order fields I get and error when ObjectDB Explorer expands a instance of ...
ORDER BY problem, when String starts with language specific character
Dear all, I have a problem with ORDER BY clause. I have a simple query: select u from User u order by u.name When the name starts with "normal/english" character, records are ordered correctly. But when it starts with language specific character like 'Č', these records are placed after records with normal charaters. So records with 'Č' are after 'Z', but this is not correct, because 'Č' is between 'C' and 'D'. #1 2011-06-23 09:24 Dear all, I have a problem with ORDER BY clause. I have a simple query: SELECT u FROM User ...
Cannot sort descending, when ordering by caluculated float in a method
Hi, I have found an issue in ordering by a method. I have two entities : Invoice and InvoiceItem. public class InvoiceItem{ .. private float price; private float amount; .. } public class Invoice{ #1 2011-06-23 19:43 Hi, I have found an issue in ordering by a method. I have two entities : Invoice and InvoiceItem. public ...
javax.persistence.criteria.CriteriaQuery
The CriteriaQuery interface defines functionality that is specific to top-level queries.(Interface of JPA)