View all files | ||||
updated 21 April 2022
In this Spring Boot project, I used JPA for persistence, MySQL being the database.
Take note, when Spring Boot (Hibernate actually) maps the java class into the database, the naming convention is critical, for example:
roboticsGrade will be mapped in the database column as robotics_grade.
Now, you might not notice this when you have create-drop setting in spring.jpa.hibernate.ddl-auto because Spring Boot automatically solves the issue. The create-drop always creates a fresh environment setup and solves conflicts between Java classes and MySQL. But when you want the persistent database record, you must set it to none.
application.properties:
As you can see in the application properties, for this project to work, make sure you have MySQL installed in your computer with gradingSystem database and student table with initial data, at least the name of the student. There are three columns you must satisfy, id, name, robotics_grade. id is the primary key with auto-increment.
Now, the time zone was configured twice, first in JDBC and second, in server env. Without these settings, errors may occur.
Remember, the Spring Framework is great already. The Spring Boot takes that to another level of abstraction.
If you have questions, please utilize the Discussions feature of GitHub.
You can also create a pull request or raise an issue to start the discussion or query/ies.
Before you compile and build, make sure you are at the project directory SpringBootProjectDir. Take note also, I'm using Maven build tool here.
In Windows,
to package your program as an executable jar file:
to simply clean and compile:
to just clean your project:
to run the program:
to build and run the program:
MIT - the permissive license