1

I want to use orderBy with one properties of my entity class please any one can suggest how to use OrderBy keyword in jpa spring repository because I am not getting this keyword in default keyword list of jpa.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
user3151058
  • 11
  • 1
  • 2
  • Possible duplicate of [How to use OrderBy with findAll in Spring Data](https://stackoverflow.com/questions/25486583/how-to-use-orderby-with-findall-in-spring-data) – Jens Schauder Feb 01 '18 at 13:31

2 Answers2

5

Use can use orderBy property of Spring Data Jpa.

findByLastnameOrderByFirstnameDesc(String lastName) 

will do what you want.

ahmetcetin
  • 2,621
  • 1
  • 22
  • 38
0

Use OrderBy e.g.

List findByLastnameOrderByFirstnameAsc(String lastname);

PaulNUK
  • 4,774
  • 2
  • 30
  • 58