Using Spring Boot Application. I have class UserService in which I am creating a dynamic query with multiple or conditions depending on request parameters:
Select care_adl_id, adl_text, hr from (select care_adl_id, adl_text, extract(hour from actual_hour)hr from adl_events) as evt where
care_adl_id = 1 and hr > 6 and hr < 15
or care_adl_id = 2 and hr > 6 and hr < 15
or care_adl_id = 3 and hr > 15 and hr < 23
I have UserRepository interface, I need to execute this query. Till now I have used JPA functions like findById etc. or @Query("Select id from Events").
How to pass this query from service class to repository and execute it?