Reputation: 1362
i have an entity for i.e stock table ( attribute item, quantity, weight, expiration date .. ecc)... how can do a dynamic query on my rest spring backend ? For i.e the user can do a query without filter but can also do a query with multiple filter for i,e quantity>0 and item = x and expiration data > yesterday... so i have to develop the parse to accept not a fixed number of parameters. My second question is that my rest api must accept = as operator but also < > >= <= != to do filter query. Thanks
Upvotes: 0
Views: 1433
Reputation: 4461
I am not sure if spring provides any such functionality. You will have to take the conditions for your filters in a map, build an expression parser and then build queries at run time.
I would say a better solution is to look at graphql.
Spring has support for GraphQL https://github.com/oembedler/graphql-spring-boot
Upvotes: 1