user3151058
user3151058

Reputation: 11

How to use OrderBy in jpa spring repository?

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.

Upvotes: 1

Views: 6991

Answers (2)

ahmetcetin
ahmetcetin

Reputation: 2970

Use can use orderBy property of Spring Data Jpa.

findByLastnameOrderByFirstnameDesc(String lastName) 

will do what you want.

Upvotes: 5

PaulNUK
PaulNUK

Reputation: 5209

Use OrderBy e.g.

List findByLastnameOrderByFirstnameAsc(String lastname);

Upvotes: 0

Related Questions