Now we can demonstrate how to develop a Spring
Boot CRUD application that connects to a My
SQL database and uses JPA for database communication.
JPA or Java Persistence API is a popular approach
for persisting Java objects to a database.
JPA abstracts the persistence layer . It provides
object-relational mapping (ORM) prevent the
developer from writing SQL for common database
operations and JDBC code for interacting with
the database.
I am going to use My SQL database.
I have installed My SQL workbence in my local
and started the server . To install My SQL
server you need to download the installer
from this My SQL community page.
Make sure the server is running in My SQL.
In My SQL server create the database named
springboot using the query CREATE DATABASE
`springboot`.
After cretaing the database, we need to create
the table Named User using the create query
. Make sure you gave all permission to root
user from the specific ip. this is required
if you are running both the data base server
and tomcat server in localhost. after creating
the query just very the access once by using
the select query. Now the table is ready to
save the table.
Now specify the connection details for the
database in the application.properties file
. This is required for the Spring Boot to
automatically create the beans for the session
factory, transaction manager and datasource
which is otherwsie we have to create manually
in traditional world. In next session we can
make changes in existing api to connect to
database
