From 1e7606189c2048d1a00d210eecb1739c0681da95 Mon Sep 17 00:00:00 2001 From: Loic Descotte Date: Tue, 13 Mar 2012 17:59:47 +0100 Subject: [PATCH] [#878] Add OrderBy support in simplified queries : fixes documentation --- documentation/manual/jpa.textile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/documentation/manual/jpa.textile b/documentation/manual/jpa.textile index c550c049fd..396faf6167 100644 --- a/documentation/manual/jpa.textile +++ b/documentation/manual/jpa.textile @@ -115,10 +115,10 @@ bc. Post.find("byTitle", "My first post").fetch(); Post.find("byTitleLike", "%hello%").fetch(); Post.find("byAuthorIsNull").fetch(); Post.find("byTitleLikeAndAuthor", "%hello%", connectedUser).fetch(); -Post.find("byTitleOrderByTitle", "%hello%").fetch(); //default for order is asc -Post.find("byTitleOrderByNbCommentsDesc", "%hello%").fetch(); +Post.find("byTitleOrderByTitle", "A nice post").fetch(); +Post.find("byTitleOrderByNbCommentsDesc", "A nice post").fetch(); -Simple queries follow the following syntax ==[Property][Comparator]And?== where Comparator can be the following: +Simple queries follow the following syntax ==[Property][Comparator]And?[Orderdirective]?== where Comparator can be the following: * @LessThan@ - less than the given value * @LessThanEquals@ - less than or equal a give value @@ -132,6 +132,11 @@ Simple queries follow the following syntax ==[Property][Comparator]And?==< * @IsNotNull@ - Not a null value (doesn't require an argument) * @IsNull@ - Is a null value (doesn't require an argument) +and Orderdirective can be (for a property named @property@) : + +* @OrderByProperty@ - default ascending order +* @OrderByPropertyDesc@ - descending order + h3. Find using a JPQL query You can use a JPQL query: