Skip to content

HQL Renderer renders CTE with CYCLE without space between SET and identifier #4012

@ZIRAKrezovic

Description

@ZIRAKrezovic

The following HQL query snippet

            WITH Tree AS (
            SELECT o.uuid AS test_uuid FROM DemoEntity o
            WHERE o.uuid = :uuid
            UNION ALL
            SELECT o.uuid AS test_uuid
            FROM Tree c
            INNER JOIN DemoEntity o ON o.parent.uuid = c.test_uuid
            ) CYCLE test_uuid SET circular TO true DEFAULT false
            SELECT test_uuid FROM Tree

Results in the following error when calling the method

org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.query.SyntaxException: At 1:204 and token 'circular', no viable alternative at input 'WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o WHERE o.uuid = :uuid UNION ALL SELECT o.uuid AS test_uuid FROM Tree c INNER JOIN DemoEntity o ON o.parent.uuid = c.test_uuid) CYCLE test_uuidSET *circular TO true DEFAULT false SELECT test_uuid FROM Tree' [WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o WHERE o.uuid = :uuid UNION ALL SELECT o.uuid AS test_uuid FROM Tree c INNER JOIN DemoEntity o ON o.parent.uuid = c.test_uuid) CYCLE test_uuidSET circular TO true DEFAULT false SELECT test_uuid FROM Tree]

As you can see, there's a space missing between CYCLE test_uuid and SET circular. This was working fine before update to 3.5.

Reproducer: https://github.com/ZIRAKrezovic/spring-data-jpa-bugs

./mvnw clean verify

Uncomment dependency management in root pom.xml to confirm it worked before.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions