Skip to content
Advertisement

Spring Data JPA- ignore parameter if it has a null value in between condition

I’m trying to write the following query

JavaScript

Now it’s work fine but I want if fromDate is null to bring all data till toDate and if toDate is null to bring all data from selected date in fromDate till current date and if both are null to ignore the condition

Advertisement

Answer

You can try next pattern

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement