Usually, Spring Data Jpa returns the entire result set of the available data from the underlying database, but in most of the case, we don't need the entire table. Relation databases like Oracle or Mysql provides top or row num features to get only desired no of records. To avil this feature Spring Data Jpa provides first
or top
keywords which are interchangeable.
first
or top
keywords can have an optional numeric value to specify the maximum result size to be returned. If no numiric value is provided then Spring Data Jpa will return a result size of 1.