k13i :
I'm using Spring Data JPA and I would like to retrieve the last record from Settings
table.
I have SettingsRepository
with standard methods implemented by Spring Data. How to write a method (or a query) to retrieve last row from the given table?
interface SettingsRepository extends JpaRepository<Settings, Long> {
// ?
}
Lemmy :
You should use findTopByOrderByIdDesc()