While developing ORM or persistence applications, we usually have to deal with low level code to have connections with store, to create repositories either with default functionality or our own custom implementations. Usually it takes lot of time and hampers actual business functionality development.
For example, if we write some application in JPA, then we have to
- Write queries for accessing data. Queries could be in string format which are error prone.
- We have to manage connection i.e. persistence unit, entity manager and factories manually.
- Inserting ,updating and deleting entities requires calls to entity manager which becomes repetitive.
As another example, let us say we have mongodb and we have to
- open connection object for mongodb.
- have knowledge of writing mondogb queries which may not be required for spring developer hence becomes a hassle.
To avoid these problems, spring data comes up with a generic model for all types of data stores. Although JPA deals with relational databases and mongodb is a NoSQL database, it can provide a generic framework as it treats them both as stores. JPA and MongoDB specific functionalities can be provided using spring data jpa and mongodb.
Spring data provides a familiar and consistent spring based programming model for NoSQL and relational stores while retaining store specific feature and capabilities.
It adds another between actual data access and application. First we will learn about jpa and then continue with mongodb.
I hope this gave a brief overview of the project.