Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadJpqlGrammarException with attribute labelled 'type' #3062

Closed
gpolet opened this issue Jul 10, 2023 · 2 comments
Closed

BadJpqlGrammarException with attribute labelled 'type' #3062

gpolet opened this issue Jul 10, 2023 · 2 comments
Assignees
Labels
in: query-parser Everything related to parsing JPQL or SQL type: regression A regression from a previous release

Comments

@gpolet
Copy link

gpolet commented Jul 10, 2023

Similarly to #3028, sping-data-jpa throws BadJpqlGrammarException: Line 1:33 no viable alternative at input 'e.type'; Bad JPQL grammar [select e from Employee e where e.type = :_type]

public interface EmployeeRepository extends JpaRepository<Employee, Long> {

    @Query("select e from Employee e where e.type = :_type")
    List<Employee> failingQuery(@Param("_type") String name);
}

Prior sping-data-jpa 3.1.0 query was working (it also seems that named parameters that are matching reserved keywords, eg: type, date, from, ..., also make the parsing crash, unlike allowed prior v3.1.0)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 10, 2023
@gregturn gregturn self-assigned this Jul 10, 2023
@gregturn gregturn added type: regression A regression from a previous release in: query-parser Everything related to parsing JPQL or SQL and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 10, 2023
@gregturn
Copy link
Contributor

I've confirmed this for JPQL parser (HQL parsing handles this just fine).

@gregturn
Copy link
Contributor

Merged to main and backported to 3.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: query-parser Everything related to parsing JPQL or SQL type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants