Hey there, welcome back friends, let's move forward. Now friends in our previous section, we have already built one restful macro service without the support of database, and here is the application. And if I show you, instead of a service layer, we were making use of a static list right. Now, we would like to use a database right. Now, in order to save some time, what we will do is we will copy these four packages right away and we will paste these four packages into our existing application. So let us do that real quick.
I will highlight this particular path which is SRC slash main slash Java. I will right click and paste the packages in here. Have you cool? And now let me open this particular package and this File application or Java file is not required. Now, let me delete it. We already have this blog dot java file where we are executing our spring application.
Alright, so now this is good enough. Now in our POM dot XML file, we have the support of MySQL and JDBC database and stuff like that right. So, we are all set with a project and we are ready to connect with the database. Now, let me run this application first of all in order to check whether everything is working properly or not. Here we go. So the application is working properly and if I show you in here, we have an entity class and that this particular entity class is what this is nothing but a depiction of a database table.
So let us open up a workbench real quick and insert our blog later. Create a table and we will give the name to the table as posts and now let us quickly add an columns first column would be ID, it would be a primary key not null and it would be also unique All right, and then we will add an A yet another column by the name of title, it would be very good 45 And finally, let us add in body column again and it would be not where care rather we will select the tiny text or text format. So in here, let us make use of text and let us give the length as maybe 200 All right. So everything is good enough let me apply the changes and it will create the database table and here is a table Alright. So there is no information inside this table as of now, so let us add in a couple of information, some data.
It would be One title could be for example, Java body would be Java tutorial. Then let us add in a jet another row, it would be like JSP and the body would be JSP tutorial. Then let us add an A yet another row, it would be for example, spring spring tutorial. And finally let us add in a jet another row and it would be like Spring Boot and it would be Spring Boot tutorial. Here we go. Let me click on Apply and let us add and then permission and now we have some data inside this particular table again, which is cool nice stuff.
All right. Now let me open up sts now in here we have a table with three columns and you need to do something special in here in order to make this particular entity class, actual entity class. Alright, now friends we will continue our journey from our next video and there's some interesting things I will show you in our next video. I hope you guys enjoyed this video. Thanks for watching, have a nice day and take care