I have an entity Movements with 3 date: dateCompte, dateValeur and dateOperation. In my repository i have a query that search Movements according these three date. Now i would like to write a query that enable the user to search by using only dateCompte or dateValeur or dateOperation. In my front end i will have a drop down list to choice the kind of date that i would like to use for the search. How i can do it? Here is my repository:
@Query("select mvt from Mouvements mvt where mvt.compte.numCompte like :x and "
+ "(mvt.dateCompte between :y and :z "
+ "or mvt.dateValeur between :y and :z "
+ "or mvt.dateOperation between :y and :z)")
public Page<Mouvements> getMouvementsByCompteAndDate(@Param("x")long numCompte,
@Param("y")LocalDate dateBefore,
@Param("z")LocalDate dateAfter, Pageable pageable)