0% found this document useful (0 votes)
2 views

diffspring

JdbcTemplate offers better performance by allowing direct SQL queries but requires more development time for DAO implementations. Spring Data simplifies development by reducing boilerplate code for CRUD operations but is slower due to its additional abstraction layer. Hibernate serves as an ORM tool that implements the Java Persistence API, while Spring Data JPA adds further abstraction for easier data access management.

Uploaded by

aravindhkumar311
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

diffspring

JdbcTemplate offers better performance by allowing direct SQL queries but requires more development time for DAO implementations. Spring Data simplifies development by reducing boilerplate code for CRUD operations but is slower due to its additional abstraction layer. Hibernate serves as an ORM tool that implements the Java Persistence API, while Spring Data JPA adds further abstraction for easier data access management.

Uploaded by

aravindhkumar311
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

JdbcTemplate:

--------------
it is faster and have better performance as you write the sql queries directly
without any layer to translate what you have typed into sql.
On the other hand, it slows down the development time, as you will have to provide
implementation for the DAO Layers and row mappers.

Spring Data :
------------
Increase the development time as you don’t need to provide implementations for
mappers or DAO Layer methods (at least for the basic CRUD operations).
All you need is to write your methods with some proper naming convention and let
spring data do the magic.

Ex:
Item findItemByCode(String code)
-> will be translated to select * from items where item.code = code

When you come to performance, for sure it is slower than using JDBC template. As
Spring data is considered a layer above JDBC template.
Ex:
For deleteItemByCode(String code):
Internally, Spring data will make a database hit to get the item by the provided
code to get its id,
then it makes another db hit to remove that item based on the id. While you can
make the removal with one query using jdbc template.

What Is Java Persistence API?


==============================
The Java Persistence API provides a specification for persisting, reading, and
managing data from your Java object to relational tables in the database.

What Is Hibernate Framework?


=============================
Hibernate is an object-relational mapping solution for Java environments.
Object-relational mapping or ORM is the programming technique to map application
domain model objects to the relational database tables.
Hibernate is a Java-based ORM tool that provides a framework for mapping
application domain objects to the relational database tables and vice versa.

Hibernate provides a reference implementation of the Java Persistence API that


makes it a great choice as ORM tool with benefits of loose coupling.

What Is Spring Data JPA?


Spring Data is a part of the Spring Framework.
The goal of Spring Data repository abstraction is to significantly reduce the
amount of boilerplate code required to implement data access layers for various
persistence stores.

Spring Data JPA is not a JPA provider. It is a library/framework that adds an extra
layer of abstraction on the top of our JPA provider (like Hibernate).
What Is the Difference Between Hibernate and Spring Data JPA?
===============================================================
Hibernate is a JPA implementation, while Spring Data JPA is a JPA Data Access
Abstraction.
Spring Data offers a solution to GenericDao custom implementations. It can also
generate JPA queries on your behalf through method name conventions.
Spring Data JPA is not an implementation or JPA provider,
it's just an abstraction used to significantly reduce the amount of boilerplate
code required to implement data access layers for various persistence stores
With Spring Data, you may use Hibernate, Eclipse Link, or any other JPA provider.
A very interesting benefit is that you can control transaction boundaries
declaratively using the @Transactional annotation.
it is faster and have better performance as you write the sql queries directly
without any layer to translate what you have typed into sql.
On the other hand, it slows down the development time, as you will have to provide
implementation for the DAO Layers and row mappers.

You might also like