About ORDER BY

manual

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. ... page covers the following topics: ORDER BY Expressions Order Direction (ASC, DESC) Grouping ...

 
api-jpa

Criteria Query Selection and Results

Reference (JavaDoc) of JPA query criteria result interfaces, including Selection, CompoundSelection, Order and Tuple.... in this group are in use for setting the SELECT and ORDER BY clauses and for representing query results as tuples. SELECT Clause ... of the SELECT clause in a criteria query is represented by Selection : javax.persistence.criteria.Selection ...

 
manual

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.... [ WHERE ... ] [ GROUP BY ... [ HAVING ... ] ] [ ORDER BY ... ] The first two clauses, SELECT and FROM ...

 
manual

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.... of a JPQL query (and a criteria query) is explained by describing the main clauses of JPQL queries (SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY): JPA Query Structure (JPQL / Criteria) ...

 
forum_thread

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; ... ... } ... owner JOIN owner.defect inverse WHERE inverse = ?1 ORDER BY owner.seqRel, ==> noteSeq ... in handling multiple order expressions in inverse (mapped by) fields. Version 2.2.2 includes a fix - please try it. Thank ... Avoid overflow of published source code examples by breaking long lines . You may mark in paragraph code words ...

 
forum_thread

Strange behaviour with ORDER BY and IN

Hi, after trying out objectdb for a while now and being quite impressed by its speed and overall performance I noticed a strange behaviour where an ORDER BY - directive isn't executed as it should be (and usually is, except in this special combination-case). ... out objectdb for a while now and being quite impressed by its speed and overall performance I noticed a strange behaviour where an ORDER BY - directive isn't executed as it should be (and usually is, except in ...

 
manual

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 after the FROM and WHERE clauses, but ...

 
forum_thread

Problem with distinct select, order by and equivalent alias/attribute path

Hi, while working with a (standard-)JPA-query generating framework we run into an exception when ordering the results of some projection when the order by expression is different (though logically equivalent) to the projection expression. Here is the example: ... ordering the results of some projection when the order by expression is different (though logically equivalent) to the projection ... s.location as s_location " + "order by s_location.id asc" ; System. out . println ( ...

 
forum_thread

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'. ... 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, ...

 
forum_thread

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{ ... Hi, I have found an issue in ordering by a method. I have two entities : Invoice and InvoiceItem. public ... very efficient...) select i from Invoice i order by i.getPrice() desc/asc it gives the same order for desc and asc ...