Jakarta Persistence 3.2: JPQL generate missing Entity default `this` alias in simple SELECT queries (#2102)
This improvement ensure, that JPQL SELECT queries like `SELECT this FROM Entity` where entity alias is not specified in the `FROM` part will be automatically added. Default `this` alias is used as it specified by: https://github.com/jakartaee/persistence/issues/452 There is automatic `SELECT this` generation for queries like `FROM Entity this` too. This happens only for EclipseLink 5.0.0 and higher or for persistence property `eclipselink.jpql.validation` with value `None` or `JPA 3.2`.
It allows accept following queries like:
- `SELECT this FROM Entity` -> `SELECT this FROM Entity this` - `SELECT COUNT(this) FROM Entity` -> `SELECT COUNT(this) FROM Entity this` - `SELECT this FROM Entity this WHERE id = :id` -> `SELECT this FROM Entity this WHERE this.id = :id` - `SELECT this FROM Entity WHERE id = :id AND UPPER(name) = 'NAME 1` -> `SELECT this FROM Entity this WHERE this.id = :id AND UPPER(this.name) = 'NAME 1'` - `FROM Entity this` -> `SELECT this FROM Entity this`
Some test modifications in the `org.eclipse.persistence.jpa.testapps` module: