Database Reference
In-Depth Information
Some of the notable features of Spring Data access are:
Session management : Spring provides efficient, easy, and safe handling of vari-
ous sessions/connections to the underlying databases. It transparently creates and
binds a session, using either a declarative or programmatic approach.
Resource management : Spring contexts easily handle the location and configur-
ation of various ORM frameworks, raw JDBC connections, or session factories.
Integrated transaction management : Spring provides an easy way to handle
and declare transactions either declaratively or programmatically. In both cases,
frameworks handle all transaction semantics and perform rollback or commit
based on the outcome of the query execution.
Handling exception : Spring wraps all database or ORM exceptions into standard
exceptions. This allows developers to handle most persistence exceptions, which
are non-recoverable, only in the appropriate layers, without annoying boilerplate
catches / throws and exception declarations.
Vendor lock-in : This is another benefit of Spring Data access where we can
switch or change our underlying database at any point of time without worrying
much about the datastore in use.
Ease of testing : Spring's inversion of control makes it easy to create Mock Ob-
jects that can be easily configured and used for unit testing of individual pieces of
code. This is another benefit when we code for Interfaces and not implementa-
tions.
But that was not enough!!!
Spring Data access was only for relational models but there are other non-relational mod-
els such as key-value stores, document stores, graph databases, and column stores, which
still followed the conventional model of coding.
The rising popularity of NoSQL databases for handling non-relational datasets led deve-
lopers again into the same problems where they were dealing with the low-level APIs of
non-relational data stores, managing connections, code for querying, unwrapping results
and transforming them into Java objects, and so on.
Spring again came forward and re-designed the complete data access layer for relational,
non-relational data, cloud data, MapReduce, and so on, into a single project called Spring
Data http://projects.spring.io/spring-data/ —for providing a consistent approach to data
access.
Search WWH ::




Custom Search