Spring MVC CRUD Application with MySQL and Hibernate

Spring MVC CRUD Application with MySQL and Hibernate is a full package of Spring MVC basic Applicaiton MVC Style of Spring development in Java. This application explains how the view is configured, how the controller is closely connected with view and somewhat with model. The application also connects with MySQL using Hibernate, so this also gives basic Idea about Spring MVC Application data connectivity.

In this post, we will see how we can execute a simple program for Spring MVC CRUD Application with MySQL and Hibernate.

  • Prerequisite

Java must be installed first.
You will also need Maven Setup done already on your machine.
You will need an IDE like Eclipse to build and execute the project.
You will also need the MySQL to be installed in the same machine.

Find the Source Code on GitHub: Spring MVC CRUD Application with MySQL and Hibernate.

  • Spring MVC CRUD Application with MySQL and Hibernate

Once above pre-requisites are done, use the GitHub project to clone and execute. Check program instructions as below.

  1. Once the JDK and Maven setup is done. In any of the empty directory checkout the Git project for springmvc-crud-app. This will be your workspace with eclipse to execute or modify the springmvc-crud-app Java Source code.

    Spring MVC CRUD Application with MySQL and Hibernate

  2. The springmvc-crud-app program will be created in Eclipse and it will have /src/main/java/ folder for writing java source code.
    Create database in MySQL using create database schoolDB query in any Database Client tool like Workbench.

    Now, run the Maven command from this Project folder to build the project and run, mvn clean install.

    Alternatively, the package can be created in target folder as below.
    target/SpringMVCCRUDApp.war

    To Run this program you will require external tomcat. Please make sure that you have installed tomcat which is also configured in your current eclipse workspace.

    Then use the URL
    http://localhost:8080/SpringMVCCRUDApp/ to execute
    and see the result on browser. The default port for tomcat will be 8080.
    Here are some CRUD operations that you can perform using this application on Student Data Model.

    Add New Student Form
    springmvc-crud-app Add Student Form

    Add New Student Success
    springmvc-crud-app Add Student Success

    Modify Student Click
    springmvc-crud-app Modify Student Click

    Modify Student Form
    springmvc-crud-app Modify Student Form

    Modify Student Success
    springmvc-crud-app Modify Student Success

    Delete Student Click
    springmvc-crud-app Delete Student Click

    Delete Student Success
    springmvc-crud-app Delete Student Success

    Student Form Validation
    springmvc-crud-app Student Form Validation

    So here we are done with the basic program for Spring MVC CRUD Application with MySQL and Hibernate.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.