Usually any spring application which includes hibernate as an ORM includes lot of plumbing configuration in form of xml. In this application all configuration has been done in java files along with proper annotations.
An entity class com.sample.spring.entity.User
has been created which stores all the users in database table(users).
Two methods of com.sample.spring.dao.UserDaoUserService
class are as following:
void add(User user) // adds a new user row in USERS table of database
List<User> listUsers() // fetches all the rows present in USERS table of database
Configure the properties in /src/main/resources/db.properties
according to your settings of mysql.
After that from the home directory of the project you need to execute the following two commands in command prompt (if you don't have gradle configured follow this link gradle installation)
gradle build
gradle run
- Sping-core - The framework used
- Hibernate - The ORM used
- Gradle - Dependency Management
- MySql - Database used