A quick tutorial for middleware products

Monday, April 8, 2019

On April 08, 2019 by Kamlesh   No comments
Java Persistance API is a specification that provides an easy way of mapping from java object to relational mapping
Why JPA?
The java bean what we try to insert into database needs to be converted into single relational row that can fit into a table, This was all taken care by ORM's (Object - relational mapping), still the problem persists as the conversion had too much of boiler plate code,JDBC Connections, Creating statements,prepared statements,hard coding the queries,looping over results sets etc, it was not really sophisticated and simple, Hence JPA.

How is it simple using JPA now??
Spring Data JPA made it more easy to map the object to relational values, usually DAO layer contains all the information about contacting with the databases, All the boilerplate code that we were writing removed completely by just an interface(not even implementation).

YES,Just an interface, Dont get confused, How it is implemented is in coming chapters!!

To use a Spring Data JPA,add the following dependency

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

0 comments:

Post a Comment