diff --git a/openjpa-project/src/doc/manual/jpa_overview_query.xml b/openjpa-project/src/doc/manual/jpa_overview_query.xml
index 730c2b38a..f2f2221a5 100644
--- a/openjpa-project/src/doc/manual/jpa_overview_query.xml
+++ b/openjpa-project/src/doc/manual/jpa_overview_query.xml
@@ -353,6 +353,45 @@ SELECT x FROM Magazine x inner join x.articles y WHERE y.authorName = 'John Doe'
+
+
+ Embeddable Traversal
+
+
+Similar to relation traversal, nested embeddable objects can be traversed using Java-like syntax.
+For example, if the Compony class has a field named "address" of
+an embeddable type Address,
+and the Address has a field named "geocode" of
+an embeddable type Geocode,
+the geocode of a company's address can be queried as follows:
+
+
+SELECT c.address.geocode FROM Company c WHERE c.name = 'Random House'
+
+
+
+The geocode returned by the above query will not be part of the state of any managed
+entity. Modifications to these embeddable instances are not allowed.
+
+
+
+Traverse into embeddable's state field is also allowed as shown in the following query:
+
+
+SELECT c.address.geocode.latitude FROM Company c WHERE c.name = 'Random House'
+
+
+Embeddable objects may contain single-valued or collection-valued relations.
+These relations can also be traversed using Java-like syntax.
+For example, if the Address has a relation field named "phoneLists" of
+an entity type PhoneNumber,
+the following query returns the PhoneNumber entities of the Company
+ named 'Random House':
+
+
+SELECT p FROM Company c, IN(c.address.phoneLists) p WHERE c.name = 'Random House'
+
+
Fetch Joins
@@ -374,6 +413,21 @@ returned instances.
Multiple fields may be specified in separate join fetch
declarations:
SELECT x FROM Magazine x join fetch x.articles join fetch x.authors WHERE x.title = 'JDJ'
+
+
+
+Notice that in the above query, both articles and authors
+are relation property in Magazine.
+JPQL syntax does not allow range variable declared for paths on the right-hand side of
+join fetch.
+Therefore, if Article entity has a relation property of
+publishers,
+it is not possible to specify a query
+that returns Magazine instances and pre-fetch
+the articles and the publishers.
+The following query will result in syntax error:
+
+SELECT x FROM Magazine x join fetch x.articles a join fetch a.publishers p WHERE x.title = 'JDJ'
@@ -414,10 +468,12 @@ SELECT x FROM Magazine x WHERE CONCAT(x.title, 's') = 'JDJs'
SUBSTRING function
-SUBSTRING(string, startIndex, length): Returns the part of
+SUBSTRING(string, startIndex, [length]): Returns the part of
the string argument starting at startIndex
-(1-based) and ending at length characters past
-startIndex.
+(1-based) and optionally ending at length characters past
+startIndex. If the length argument is not specified,
+the substring from the startIndex to the end of the string
+is returned.
SELECT x FROM Magazine x WHERE SUBSTRING(x.title, 1, 1) = 'J'
@@ -536,6 +592,26 @@ SELECT x FROM Magazine x WHERE SQRT(x.price) >= 1.00
SELECT x FROM Magazine x WHERE MOD(x.price, 10) = 0
+
+
+
+
+
+
+ INDEX function
+
+
+INDEX(identification_variable): Returns an integer value corresponding
+ to the position of its argument in an ordered list.
+ The INDEX function can only be applied to identification variables denoting types for
+which an order column has been specified.
+
+
+In the following example, studentWaitlist is a list of students for which an order column has
+been specified, the query returns the name of the first student on the waitiing list of the course named 'Calculus':
+
+
+SELECT w.name FROM Course c JOIN c.studentWaitlist w WHERE c.name = ‘Calculus’ AND INDEX(w) = 0
@@ -585,6 +661,10 @@ example, the following query may return instances of Magazine
Digest are Magazine subclasses.
SELECT x FROM Magazine x WHERE x.price < 5
+
+Non-polymorphic queries or queries whose polymorphism is restricted can be specified using entity
+type expressions in the WHERE clause to restrict the domain of the query.
+