jakartaee / jakartaee/persistence

some errors (?) in the JPQL grammar

Open
#752 0 comments 0 reactions 0 assignees Claimed by @gavinking View on GitHub
candidate-for-4
Dominant language
Java
Stars
267
Forks
78
Avg merge
1d 6h
Merged PRs (30d)
13

Description

While [working on the Query spec](https://github.com/jakartaee/query/issues/24), I ran into the following things:

```
state_valued_path_expression ::=
state_field_path_expression | *general_identification_variable*
```

How can an identification variable can't represent a basic value?

```
type_discriminator ::=
TYPE(general_identification_variable |
single_valued_object_path_expression |
*input_parameter*)
```

What was input_parameter doing there?

```
single_valued_path_expression ::=
qualified_identification_variable |
**TREAT(qualified_identification_variable AS subtype)** |
state_field_path_expression |
single_valued_object_path_expression
```

What could possibly have been the intention of allowing `TREAT(ENTRY(...))`, `TREAT(KEY(...))`, `TREAT(VALUE(...))` there, in a location where `TREAT()` is not even allowed for a regular `identification_variable`.

I think these things are so clearly wrong that we might as well fix them here too.

Contributor guide

Open the contributing guide

Research direction

Start with the JPQL grammar productions quoted in the issue and compare their allowed alternatives with the surrounding grammar specification. Check linked pull request #753 to understand the work already underway; done means the reported grammar inconsistencies are resolved in the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.