Skip to content

Hibernate: entity identifier variable THIS with any uppercase characters is unsupported #33182

@KyleAure

Description

@KyleAure

resolution: Hibernate is fixing

When using Hibernate as the Persistence provider for Jakarta Data the following error can occur:

jakarta.data.exceptions.MappingException: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: Could not interpret path expression 'THIS'

For JPQL queries:

SELECT VERSION(THIS) FROM City WHERE name = ?1 AND stateName = ?2
SELECT CASE WHEN COUNT(THIS) > 0 THEN TRUE ELSE FALSE END FROM Business WHERE location.address.houseNum = :houseNum   AND location.address.street.name = :streetName   AND location.address.street.direction = :streetDir   AND name = :businessName

Reason: This seems like a bug in Hibernate where Hibernate does not recognize the entity identification variable THIS when it has any upper case characters, such as in version(THIS) and count(THIS) and id(THIS) and id(This). These are not parsed correctly and an exception is thrown.

Documentation: https://jakarta.ee/specifications/persistence/3.2/jakarta-persistence-spec-3.2#identifier-and-version-functions

Resolution: Open issue with Hibernate

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions