When I create any repository in spring framework like following it gives method by default to get all records of the entity using this API
GET : http://localhost:3000/api/addresses
It sends data from ascending order But If I want my data in descending order than How can I specify this ?
Address Repository
public interface AddressRepository extends JpaRepository<Address, Long>
{
}
Perhaps,you can :
localhost:3000/api/addresses?sort={property},desc
this will help you sort by property desc
You can also specify this as part of your request, take a look at documentation here Sorting.
Also please take a look at similar answer here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With