Introduction to the 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:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
- 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.
- JPA Extension
- JDBC Extension
- Query DSL
- The separate open-source project, that provides type safety for executing queries.
- Big Data
- HDFS and M/R
Few Popular Released Modules in this framework:
Below are some of the major released modules under the Spring Data project:
- Spring Data JDBC
- Spring Data JPA
- Spring Data Commons
- Spring Data REST
- Spring Data KeyValue
- Spring Data MongoDB
- Spring Data LDAP
- Spring Data Redis
- Spring Data for Apache Cassandra
- Spring Data for Apache Solr
- Spring Data for Apache Geode
- 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.
- 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.
- QueryDSL: Enables the construction of type-safe SQL like queries for multiple backends including MongoDB, Lucence, JPA, JDO, SQL, and plain collection in Java.
- NoSQL Data Models: NoSQL data models usually get represented in key-value pairs and it mostly documented either as JSON or as Graphs.
- 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.
- HBase: It is a column-oriented database. where Row points to “columns” which are key-value pairs. Columns can be grouped into column families.
- 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.
- 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.