eclipselink icon indicating copy to clipboard operation
eclipselink copied to clipboard

[master] Jakarta Persistence 3.2: JPQL generate missing Entity default `this` alias in simple SELECT queries

Open rfelcman opened this issue 11 months ago • 0 comments

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 happen only if <property name="eclipselink.jpql.validation" value="None"/> persistence property with value None is specified.

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

rfelcman avatar Mar 20 '24 13:03 rfelcman