diffspring
diffspring
--------------
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.
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.