I have entity Item with fields - id,...,status
How can I write select for get row with last Id?
I tried this
Item findTopByStatusDesc(int status);
and
Item findOneByStatusDesc(int status);
Byt it not worked.
id name status
1 hz 0
2 hz2 1
3 hz3 1
I need get only one row where status = 1 and id latest 3 hz3 1
I need order DESC and get first row but I can not
You can limit query results -
Or
Ref -
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.limit-query-result