Class JPQLSingleStringParser

  extended by org.datanucleus.query.JPQLSingleStringParser

public class JPQLSingleStringParser
extends java.lang.Object

Parser for handling JPQL Single-String queries. Takes a JPQLQuery and the query string and parses it into its constituent parts, updating the JPQLQuery accordingly with the result that after calling the parse() method the JPQLQuery is populated.

 SELECT [ {result} ]
        [FROM {candidate-classes} ]
        [WHERE {filter}]
        [GROUP BY {grouping-clause} ]
        [HAVING {having-clause} ]
        [ORDER BY {ordering-clause}]
 e.g SELECT c FROM Customer c INNER JOIN c.orders o WHERE c.status = 1
 UPDATE {update-clause}
 WHERE {filter}
 and update-clause is of the form
 "Entity [[AS] identifier] SET {field = new_value}, ..."
 DELETE {delete-clause}
 WHERE {filter}
 and delete-clause is of the form
 "FROM Entity [[AS] identifier]"

Note that {filter} and {having-clause} can contain subqueries, hence containing keywords

 SELECT c FROM Customer c WHERE NOT EXISTS (SELECT o1 FROM c.orders o1)
So the "filter" for the outer query is "NOT EXISTS (SELECT o1 FROM c.orders o1)"

Field Summary
protected static Localiser LOCALISER
          Localiser for messages.
Constructor Summary
JPQLSingleStringParser(Query query, java.lang.String queryString)
          Constructor for the Single-String parser.
Method Summary
 void parse()
          Method to parse the Single-String query
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected static final Localiser LOCALISER
Localiser for messages.

Constructor Detail


public JPQLSingleStringParser(Query query,
                              java.lang.String queryString)
Constructor for the Single-String parser.

query - The query into which we populate the components of the query
queryString - The Single-String query
Method Detail


public void parse()
Method to parse the Single-String query

Copyright © 2010. All Rights Reserved.