I am working on a Spring Boot and Angular application which has a requirement to search based on any number of the available filters being applied to a list. For example, a user searches on 'Title' and 'Author,' but not 'Edition.'

I am comfortable with how I'll accomplish this at all layers except for the ORM. In my head the process would be to simply include the criteria for which the user has submitted values. However, with the tools available in JPA, I do not see a clear path to success. I believe my options are JPA's Criteria API, or Query DSL. I either case, it seems like I'd have to write a bunch of conditional logic to append .and or the equivalent on to a query. Is there a way to pass argument lists to JPA, similar to ActiveRecord? Am I asking the right questions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.