Matt-pow
Matt-pow

Reputation: 986

Spring Data JPA - finding number of rows from the database

I am a noob in Spring framework. I know there is the findAll method to query all the data in a database. Is there a way to count the number of rows in a database using the Spring framework and doesn't require to write a SQL query?

Upvotes: 9

Views: 14605

Answers (1)

Matej Marconak
Matej Marconak

Reputation: 1413

There is a method count() in CrudRepository. You can check official documentation.

Upvotes: 15

Related Questions