Introduction to Spring Data

The following two tabs change content below.
Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Latest posts by Prasad Kharkar (see all)

We have learned about Java Persistence API and MongoDB in another tutorial series.Here, we will learn about spring data which mainly deal with spring data variants i.e.  jpa and mongodb. 


Spring Data:

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.

Share Button

3 comments for “Introduction to Spring Data

  1. Raichand
    March 8, 2017 at 7:36 pm

    Look at this URL it is also a good example


Leave a Reply to Prasad Kharkar Cancel reply

Your email address will not be published. Required fields are marked *