Open In App

Introduction to the Spring Data Framework

Last Updated : 01 Jun, 2020
Like Article

In the previous article, we have already discussed about spring framework and spring boot. In this article, we will understand about spring data framework.

The need for Spring Data Framework
Our digital world is holding more than 20 zettabytes of data, and that is around as many bits of information as the stars in our physical universe. These data come from various sources such as Banking, Retail, e-commerce, Education, Construction, social networking sites etc, and available in both the forms (i.e.), structured as well as unstructured. The cost of creating, capturing, storing, and managing these data is the biggest challenge for the industry. There are many software and frameworks which are available in the market that has solved this problem up to some extent. But still these frameworks struggle with issues such as:

  • It is extremely difficult and impossible to scale writes in RDBMS.
  • Scaling it vertically or horizontally has either some limitations or expensive.

This has been solved with NoSQL data which emerged as a point solution with an idea of shifting from ACID(Atomicity, Consistency, Isolation, and Durability) to BASE(Basically Available, Scalable, Eventually Consistent). NoSQL is an ongoing trend and is an option for developers for non-relational databases to use the right tool for the right job. Apart from NoSQL, we do have Big Data which refers to a dataset whose size is beyond the ability of typical database software tools to capture, store, manage and analyze the data. Big data, in almost every industry, ranging from 10’s of TB(Terabyte) to multiple PB(PetaByte).

So, we can observe that the data access landscape has changed considerably. RDBMS is still important but couldn’t be considered as a “One size fits all” solution. We also know that the Spring framework has always provided great support for RDBMS data access but was lacking to deal with other kinds of data access(NoSQL and BigData). So the Spring Data project’s goal is to refresh the Spring data support with all kinds of data technologies(relational data, non-relational data, and Big Data) while retaining store-specific features and capabilities.

Spring Data Framework:

Spring data framework is the parent project which contains many sub-frameworks. All these sub frameworks deal with data access which is specific to a database. The design objective of this framework is to provide a Spring-based familiar and consistent model for all data access technologies like relational or non-relational databases, cloud-based technologies, or map-reduce frameworks. In short Spring Data is an initiative to give Spring developers easy access to the emerging world of NoSQL. Below are the range of technologies that Spring Data support actively.

  1. Relational
    • JPA Extension
    • JDBC Extension
  2. Non-Relational
    • Redis
    • Mongo
    • HBase
    • Neo4J
    • Gemfire
    • Lucene
  3. Query DSL
    • The separate open-source project, that provides type safety for executing queries.
  4. Big Data
    • Hadoop
    • HDFS and M/R
    • Hive
    • Pig
    • Cascading

Few Popular Released Modules in this framework:

Below are some of the major released modules under the Spring Data project:

  1. Spring Data JDBC
  2. Spring Data JPA
  3. Spring Data Commons
  4. Spring Data REST
  5. Spring Data KeyValue
  6. Spring Data MongoDB
  7. Spring Data LDAP
  8. Spring Data Redis
  9. Spring Data for Apache Cassandra
  10. Spring Data for Apache Solr
  11. Spring Data for Apache Geode
  12. Spring Data for Pivotal GemFire

Module under development:

Currently, the spring data R2DBC module is under development. The features of this module are:

  • Repository Support.
  • Resource allocation and exception translation through templates.
  • Object/Datastore Mapping for SQL and NoSQL data stores.
  • Dynamic derived queries from repositories methods name.
  • Transparent auditing support.

Keywords and Definition: Below are some of the key terms and their definitions used in the Spring Data frameworks.

  1. Repositories: Mediates between the data mapping layers and the domain through a collection-like interface for accessing domain objects.
    • Create POJO which will be your model or entity.
    • Extend a repository interface for CRUD operations, and add query methods(finder methods).
    • Configure Spring to scan for repository interfaces and create implementations.
    • Inject implementations into your services.
  2. QueryDSL: Enables the construction of type-safe SQL like queries for multiple backends including MongoDB, Lucence, JPA, JDO, SQL, and plain collection in Java.
  3. NoSQL Data Models: NoSQL data models usually get represented in key-value pairs and it mostly documented either as JSON or as Graphs.
  4. Redis: It is a persistent caching framework work on key-value store. It comes with plenty of features and supports a rich set of data types (String, Binary, Lists, Sets, OrderedSets, HashMap, etc). It can take a periodic snapshot of memory and can append commands to a log file.
  5. HBase: It is a column-oriented database. where Row points to “columns” which are key-value pairs. Columns can be grouped into column families.
  6. MongoDB: It is an open-source, scalable, high-performance, document-oriented JSON-style database, where documents are organized in collections. It is considered as one of the rich query languages for dynamic queries. It has Geospatial features.
  7. Graphs Graphs are a general-purpose data structure. Graphs in the context of data don’t mean for charts, diagram or vector artwork, but has a special meaning for storing data which is structured as a graph.

Finally, we can conclude that the spring data is an umbrella project which has been designed with an intent to unify and ease the access to all kinds of the database system.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads