Skip to content
Advertisement

Spring data jpa, how to filter and then sort results in this example?

I wrote a method, but as you can see – Category here is never used.

Is to possible to find only Dishes where Category is same as defined and only after it – sort it by parameter using plain Spring data jpa? Or the only way to it is a custom query?

JavaScript

Advertisement

Answer

You could add a method like below to your DishRepository and it should be able to achieve that without needing to write custom query with @Query() annotation

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