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

Using operator '!=' throws BadJpqlGrammarException in spring data jpa 3.1.1 #3061

Closed
gpolet opened this issue Jul 10, 2023 · 3 comments
Closed
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

It seems that the != operator is not supported in spring-data-jpa 3.1.1 (See issue #2970). I (mis?)understood it would be fixed in 3.1.1.

The following query below fails with BadJpqlGrammarException

public interface EmployeeRepository extends JpaRepository<Employee, Long> {

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

}

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 10, 2023
@mp911de mp911de 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

gregturn commented Jul 10, 2023

That patch was for HQL:

https://github.com/spring-projects/spring-data-jpa/blob/3.1.x/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Hql.g4#L592

If you're using EclipseLink or some other JPA provider (or you haven't picked up that version of Spring Data JPA 3.1), then you won't see it.

What JPA provider did you use in the past, and did this query used to work before Spring Data JPA 3.1?

@gregturn gregturn added status: waiting-for-feedback We need additional information before we can continue and removed type: regression A regression from a previous release labels Jul 10, 2023
@gpolet
Copy link
Author

gpolet commented Jul 11, 2023

Hi @gregturn . Indeed, we're using EclipseLink.
I confirm that this kind of query worked without issues before Spring Data JPA 3.1.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 11, 2023
@gregturn gregturn added type: regression A regression from a previous release and removed status: feedback-provided Feedback has been provided labels Jul 11, 2023
@gregturn
Copy link
Contributor

I'll mark this is a regression and will move to patch the JPQL parser to handle this.

gregturn added a commit that referenced this issue Jul 11, 2023
gregturn added a commit that referenced this issue Jul 11, 2023
gregturn added a commit that referenced this issue Jul 11, 2023
@gregturn gregturn added this to the 3.1.2 (2023.0.2) milestone Jul 11, 2023
@mp911de mp911de closed this as completed Jul 12, 2023
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

4 participants