Adding the repository layer

Once the entities have been mapped, and the connections are done, it's time to create our repositories. The Spring Data Framework provides some interfaces that can be used in different use cases. We will use the specialization for the MongoDB database, which is MongoRepository. It extends the PagingAndSortingRepository and QueryByExampleExecutor. The first is about pagination and sorting features, and the other is about queries by example.

In some cases, the database query result set can be very large. This can cause some application performance issues because we will fetch a lot of database records. We can limit the number of records fetched from the database and configure limits for that. This technique is called ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.