'LocalDate as where clause in Intellij's JPA Console

Let's say I have a Person with a name and a birth date. Entity model is as follow :

@Entity
public class Person {
    private int id;
    private String name;
    private LocalDate birthDate;
    // constructors, getters and setters...
}

With the JPA Console, I would like to write a query like this :

@Query("select p from Person p where p.birthDate between :start and :stop")
List<Person> getPeopleBornBetween(LocalDate start, LocalDate stop);

If I try the query as it is and write the date between ' , parameters do not match expected type.
I cannot use Local.parse(...) in the parameters popup window neither in the console.
I also cannot use p.birthDate.format(...) in the console.

What should I do ?



Solution 1:[1]

There might be a problem in you query, try this one:

select p from Person p where p.birthDate between :start and :stop
                     ^

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 streetturtle