Spring-ORM is a technique or a Design Pattern used to access a relational database from an object-oriented language. ORM (Object Relation Mapping) covers many persistence technologies. They are as follows:
- JPA(Java Persistence API): It is mainly used to persist data between Java objects and relational databases. It acts as a bridge between object-oriented domain models and relational database systems.
- JDO(Java Data Objects): It is one of the standard ways to access persistent data in databases, by using plain old Java objects (POJO) to represent persistent data.
- Hibernate - It is a Java framework that simplifies the development of Java applications to interact with the database.
- Oracle Toplink, and iBATIS: Oracle TopLink is a mapping and persistence framework for Java development.
For the above technologies, Spring provides integration classes so that each of these techniques can be used following Spring principles of configuration, and easily integrates with Spring transaction management.
For each of the above technologies, the configuration consists of injecting the DataSource bean into some kind of SessionFactory or EntityManagerFactory, etc. For pure JDBC(Java Database Connectivity), integration classes are not required apart from JdbcTemplate because JDBC only depends on a DataSource.
If someone wants to use an ORM like JPA(Java Persistence API) or Hibernate then you do not need spring-JDBC, but only this module.
Tip: Pre-requisites required before learning/reading Spring ORM Framework are given below as follows:
- Strong knowledge of Java is required
- Knowledge of the spring framework is required
- Knowledge of the above-mentioned persistence technologies is also required.
Note: The Spring Framework is an application framework and also an inversion of the control container for the Java platform. The framework's core features can be used by any of the Java applications, but there are some extensions for building web applications on top of the Java EE (Enterprise Edition) platform.
Advantages of the Spring Framework About ORM Frameworks
- Due to the Spring framework, you do not need to write extra codes before and after the actual database logic such as getting the connection, starting the transaction, committing the transaction, closing the connection, etc.
- Spring has an IoC(Inversion of control) approach which makes it easy to test the application.
- Spring framework provides its API for exception handling along with the ORM framework.
- By using the Spring framework, we can wrap our mapping code with an explicit template wrapper class or AOP(Aspect-oriented programming) style method interceptor.
Related Articles:
Similar Reads
Spring - MVC Framework The Spring MVC Framework follows the Model-View-Controller architectural design pattern, which works around the Front Controller, i.e., the Dispatcher Servlet. The Dispatcher Servlet handles and dispatches all incoming HTTP requests to the appropriate controller. It uses @Controller and @RequestMapp
4 min read
Introduction to Spring Framework The Spring Framework is a powerful, lightweight, and widely used Java framework for building enterprise applications. It provides a comprehensive programming and configuration model for Java-based applications, making development faster, scalable, and maintainable.Before Enterprise Java Beans (EJB),
9 min read
Spring Framework Annotations Spring framework is one of the most popular Java EE frameworks. It is an open-source lightweight framework that allows Java EE 7 developers to build simple, reliable, and scalable enterprise applications. Spring framework mainly focuses on providing various ways to help you manage your business obje
6 min read
What is Spring Framework and Hibernate ORM? Spring Framework is an open-source Java framework that is used to develop enterprise-level applications. It provides a wide range of features and functionalities such as inversion of control (IoC), dependency injection (DI), aspect-oriented programming (AOP), and more. These features help developers
5 min read
Spring Framework Architecture The Spring framework is a widely used open-source Java framework that provides a comprehensive programming and configuration model for building enterprise applications. Its architecture is designed around two core principles: Dependency Injection (DI) Aspect-Oriented Programming (AOP)The Spring fram
7 min read