Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.parser

public final Class JPQLGrammar1_0

extends AbstractJPQLGrammar
Class Inheritance
Annotations
@SuppressWarnings:nls
Imports
org.eclipse.persistence.jpa.jpql.ExpressionTools, .JPAVersion

This JPQLGrammar provides support for parsing JPQL queries defined in JSR-220 - Enterprise JavaBeans 3.0.

The following is the JPQL grammar defined in JPA version 1.0.
 QL_statement ::= select_statement | update_statement | delete_statement

select_statement ::= select_clause from_clause [where_clause] [groupby_clause] [having_clause] [orderby_clause]

update_statement ::= update_clause [where_clause]

delete_statement ::= delete_clause [where_clause]

from_clause ::= FROM identification_variable_declaration {, {identification_variable_declaration | collection_member_declaration}}*

identification_variable_declaration ::= range_variable_declaration { join | fetch_join }*

range_variable_declaration ::= abstract_schema_name [AS] identification_variable

join ::= join_spec join_association_path_expression [AS] identification_variable

fetch_join ::= join_spec FETCH join_association_path_expression

association_path_expression ::= collection_valued_path_expression | single_valued_association_path_expression

join_spec::= [ LEFT [OUTER] | INNER ] JOIN

join_association_path_expression ::= join_collection_valued_path_expression |
                                     join_single_valued_association_path_expression

join_collection_valued_path_expression::= identification_variable.collection_valued_association_field

join_single_valued_association_path_expression::= identification_variable.single_valued_association_field

collection_member_declaration ::= IN (collection_valued_path_expression) [AS] identification_variable

single_valued_path_expression ::= state_field_path_expression |
                                  single_valued_association_path_expression

state_field_path_expression ::= {identification_variable | single_valued_association_path_expression}.state_field

single_valued_association_path_expression ::= identification_variable.{single_valued_association_field.}* single_valued_association_field

collection_valued_path_expression ::= identification_variable.{single_valued_association_field.}*collection_valued_association_field

state_field ::= {embedded_class_state_field.}*simple_state_field

update_clause ::= UPDATE abstract_schema_name [[AS] identification_variable] SET update_item {, update_item}*

update_item ::= [identification_variable.]{state_field | single_valued_association_field} = new_value

new_value ::= simple_arithmetic_expression |
              string_primary |
              datetime_primary |
              boolean_primary |
              enum_primary |
              simple_entity_expression |
              NULL

delete_clause ::= DELETE FROM abstract_schema_name [[AS] identification_variable]

select_clause ::= SELECT [DISTINCT] select_expression {, select_expression}*

select_expression ::= single_valued_path_expression |
                      aggregate_expression |
                      identification_variable |
                      OBJECT(identification_variable) |
                      constructor_expression

constructor_expression ::= NEW constructor_name ( constructor_item {, constructor_item}* )

constructor_item ::= single_valued_path_expression | aggregate_expression

aggregate_expression ::= { AVG | MAX | MIN | SUM } ([DISTINCT] state_field_path_expression) |
                         COUNT ([DISTINCT] identification_variable |
                                           state_field_path_expression |
                                           single_valued_association_path_expression)

where_clause ::= WHERE conditional_expression

groupby_clause ::= GROUP BY groupby_item {, groupby_item}*

groupby_item ::= single_valued_path_expression | identification_variable

having_clause ::= HAVING conditional_expression

orderby_clause ::= ORDER BY orderby_item {, orderby_item}*

orderby_item ::= state_field_path_expression [ ASC | DESC ]

subquery ::= simple_select_clause subquery_from_clause [where_clause] [groupby_clause] [having_clause]

subquery_from_clause ::= FROM subselect_identification_variable_declaration {, subselect_identification_variable_declaration}*

subselect_identification_variable_declaration ::= identification_variable_declaration |
                                                  association_path_expression [AS] identification_variable |
                                                  collection_member_declaration

simple_select_clause ::= SELECT [DISTINCT] simple_select_expression

simple_select_expression::= single_valued_path_expression |
                            aggregate_expression |
                            identification_variable

conditional_expression ::= conditional_term | conditional_expression OR conditional_term

conditional_term ::= conditional_factor | conditional_term AND conditional_factor

conditional_factor ::= [ NOT ] conditional_primary

conditional_primary ::= simple_cond_expression | (conditional_expression)

simple_cond_expression ::= comparison_expression |
                           between_expression |
                           like_expression |
                           in_expression |
                           null_comparison_expression |
                           empty_collection_comparison_expression |
                           collection_member_expression |
                           exists_expression

between_expression ::= arithmetic_expression [NOT] BETWEEN arithmetic_expression AND arithmetic_expression |
                       string_expression [NOT] BETWEEN string_expression AND string_expression |
                       datetime_expression [NOT] BETWEEN datetime_expression AND datetime_expression

in_expression ::= state_field_path_expression [NOT] IN ( in_item {, in_item}* | subquery)

in_item ::= literal | input_parameter

like_expression ::= string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]

escape_character ::= single_character_string_literal | character_valued_input_parameter

null_comparison_expression ::= {single_valued_path_expression | input_parameter} IS [NOT] NULL

empty_collection_comparison_expression ::= collection_valued_path_expression IS [NOT] EMPTY

collection_member_expression ::= entity_expression [NOT] MEMBER [OF] collection_valued_path_expression

exists_expression::= [NOT] EXISTS (subquery)

all_or_any_expression ::= { ALL | ANY | SOME} (subquery)

comparison_expression ::= string_expression comparison_operator {string_expression | all_or_any_expression} |
                          boolean_expression { = | <> } {boolean_expression | all_or_any_expression} |
                          enum_expression { = | <> } {enum_expression | all_or_any_expression} |
                          datetime_expression comparison_operator {datetime_expression | all_or_any_expression} |
                          entity_expression { = | <> } {entity_expression | all_or_any_expression} |
                          arithmetic_expression comparison_operator {arithmetic_expression | all_or_any_expression}

comparison_operator ::= = | > | >= | < | <= | <>

arithmetic_expression ::= simple_arithmetic_expression | (subquery)

simple_arithmetic_expression ::= arithmetic_term | simple_arithmetic_expression { + | - } arithmetic_term

arithmetic_term ::= arithmetic_factor | arithmetic_term { * | / } arithmetic_factor

arithmetic_factor ::= [{ + | - }] arithmetic_primary

arithmetic_primary ::= state_field_path_expression |
                       numeric_literal |
                       (simple_arithmetic_expression) |
                       input_parameter |
                       functions_returning_numerics |
                       aggregate_expression

string_expression ::= string_primary | (subquery)

string_primary ::= state_field_path_expression |
                   string_literal |
                   input_parameter |
                   functions_returning_strings |
                   aggregate_expression

datetime_expression ::= datetime_primary | (subquery)

datetime_primary ::= state_field_path_expression |
                     input_parameter |
                     functions_returning_datetime |
                     aggregate_expression

boolean_expression ::= boolean_primary | (subquery)

boolean_primary ::= state_field_path_expression | boolean_literal | input_parameter |

enum_expression ::= enum_primary | (subquery)

enum_primary ::= state_field_path_expression | enum_literal | input_parameter

entity_expression ::= single_valued_association_path_expression | simple_entity_expression

simple_entity_expression ::= identification_variable | input_parameter

functions_returning_numerics::= LENGTH(string_primary) |
                                LOCATE(string_primary, string_primary[, simple_arithmetic_expression]) |
                                ABS(simple_arithmetic_expression) |
                                SQRT(simple_arithmetic_expression) |
                                MOD(simple_arithmetic_expression, simple_arithmetic_expression) |
                                SIZE(collection_valued_path_expression)

functions_returning_datetime ::= CURRENT_DATE| CURRENT_TIME | CURRENT_TIMESTAMP

functions_returning_strings ::= CONCAT(string_primary, string_primary) |
                                SUBSTRING(string_primary, simple_arithmetic_expression, simple_arithmetic_expression) |
                                TRIM([[trim_specification] [trim_character] FROM] string_primary) |
                                LOWER(string_primary) |
                                UPPER(string_primary)

trim_specification ::= LEADING | TRAILING | BOTH

boolean_literal ::= TRUE | FALSE

string_literal ::= 'string'

enum_literal ::= {package_name.}*EnumType.CONSTANT

literalTemporal ::= date_literal | TIME_LITERAL | TIMESTAMP_LITERAL

input_parameter ::= (':' [a-zA-Z]+) | ('?' [0-9]+);  // TODO: TO COMPLETE

date_literal ::= "{" "'d'" (' ' | '\t')+ '\'' DATE_STRING '\'' (' ' | '\t')* "}"

TIME_LITERAL ::= "{" "'t'" (' ' | '\t')+ '\'' TIME_STRING '\'' (' ' | '\t')* "}"

TIMESTAMP_LITERAL ::= "{" ('ts') (' ' | '\t')+ '\'' DATE_STRING ' ' TIME_STRING '\'' (' ' | '\t')* "}"

DATE_STRING ::= [0-9] [0-9] [0-9] [0-9] '-' [0-9] [0-9] '-' [0-9] [0-9]

TIME_STRING ::= [0-9] ([0-9])? ':' [0-9] [0-9] ':' [0-9] [0-9] '.' [0-9]*

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Author
Pascal Filion
Since
2.4
Version
2.5

Field Summary

Modifier and TypeField and Description
private static final JPQLGrammar
INSTANCE

The singleton instance of this JPQLGrammar1_0.

Constructor Summary

AccessConstructor and Description
public
JPQLGrammar1_0()

Creates a new JPQLGrammar1_0.

Method Summary

Modifier and TypeMethod and Description
protected JPQLGrammar
buildBaseGrammar()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.buildBaseGrammar.

Creates the base JPQLGrammar this one extends, if one exists.
public JPAVersion
getJPAVersion()

Implements org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getJPAVersion.

Returns the JPAVersion of the Java Persistence supported by this grammar.
public String
getProvider()

Implements org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getProvider.

Returns the persistence provider name.
public String
getProviderVersion()

Implements org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getProviderVersion.

Returns the version of the persistence provider.
protected void
initializeBNFs()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeBNFs.

Registers the JPQL query BNFs defining the JPQL grammar.
protected void
protected void
public static JPQLGrammar

Returns:

The JPQLGrammar that only has support for JPA 1.0
instance
()

Returns the singleton instance of the default implementation of JPQLGrammar which provides support for the JPQL grammar defined in the JPA 1.0 functional specification.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar:
addChildBNFaddChildFactoryaddIdentifieraddIdentifiersbuildExpressionRegistrygetBaseGrammargetExpressionRegistryinitializeregisterBNFregisterFactoryregisterIdentifierRoleregisterIdentifierVersionsetFallbackBNFIdsetFallbackExpressionFactoryIdsetHandleCollectionsetHandleNestedArraysetHandleSubExpression

Field Detail

INSTANCEback to summary
private static final JPQLGrammar INSTANCE

The singleton instance of this JPQLGrammar1_0.

Constructor Detail

JPQLGrammar1_0back to summary
public JPQLGrammar1_0()

Creates a new JPQLGrammar1_0.

Method Detail

buildBaseGrammarback to summary
protected JPQLGrammar buildBaseGrammar()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.buildBaseGrammar.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.buildBaseGrammar.

Creates the base JPQLGrammar this one extends, if one exists.

Important Note

The singleton instance of any JPQLGrammar (for example JPQLGrammar1_0.instance() cannot be used, the API does not support extending it, a new instance has to be created.

Returns:JPQLGrammar

The base JPQLGrammar or null if there is no base grammar

Annotations
@Override
getJPAVersionback to summary
public JPAVersion getJPAVersion()

Implements org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getJPAVersion.

Doc from org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getJPAVersion.

Returns the JPAVersion of the Java Persistence supported by this grammar.

Returns:JPAVersion

The JPA version supported by this grammar

Annotations
@Override
getProviderback to summary
public String getProvider()

Implements org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getProvider.

Doc from org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getProvider.

Returns the persistence provider name.

Returns:String

The name of the persistence provider, null should never be returned

Annotations
@Override
getProviderVersionback to summary
public String getProviderVersion()

Implements org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getProviderVersion.

Doc from org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar.getProviderVersion.

Returns the version of the persistence provider.

Returns:String

The version of the persistence provider, if one is extending the default JPQL grammar defined in the Java Persistence specification, otherwise returns an empty string

Annotations
@Override
initializeBNFsback to summary
protected void initializeBNFs()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeBNFs.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeBNFs.

Registers the JPQL query BNFs defining the JPQL grammar.

Annotations
@Override
initializeExpressionFactoriesback to summary
protected void initializeExpressionFactories()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeExpressionFactories.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeExpressionFactories.

Registers the ExpressionFactories required to properly parse JPQL queries. An ExpressionFactory is responsible to create an Expression object that represents a portion of the JPQL query.

Annotations
@Override
initializeIdentifiersback to summary
protected void initializeIdentifiers()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeIdentifiers.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractJPQLGrammar.initializeIdentifiers.

Registers the JPQL identifiers support by this JPQLGrammar. The registration involves registering the JPAVersion and the IdentifierRole.

Annotations
@Override
instanceback to summary
public static JPQLGrammar instance()

Returns the singleton instance of the default implementation of JPQLGrammar which provides support for the JPQL grammar defined in the JPA 1.0 functional specification.

Returns:JPQLGrammar

The JPQLGrammar that only has support for JPA 1.0

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override