This configuration class sets up essential beans for the application, including data sources, DAOs, and services.
-
sessionFactory(): Provides an instance of
SessionFactory
. -
userDAO(): Creates a
UserDAO
bean with a specifiedDataSource
. -
userService(): Creates a
UserService
bean. -
traineeDAO(): Creates a
TraineeDAO
bean with a specifiedDataSource
. -
traineeService(): Creates a
TraineeService
bean. -
trainerDAO(): Creates a
TrainerDAO
bean with a specifiedDataSource
. -
trainerService(): Creates a
TrainerService
bean. -
trainingDAO(): Creates a
TrainingDAO
bean with a specifiedDataSource
. -
trainingService(): Creates a
TrainingService
bean. -
facade(UserService, TraineeService, TrainerService, TrainingService): Creates a
Facade
bean, injecting dependencies for user, trainee, trainer, and training services.
The User
class represents a user entity in the system.
- id (Long): Unique identifier for the user.
- firstName (String): First name of the user.
- lastName (String): Last name of the user.
- username (String): Unique username for the user.
- password (String): User's password.
- isActive (Boolean): Indicates whether the user is active.
- User(): Default constructor.
- User(Long id, String firstName, String lastName, String username, String password, Boolean isActive): Parameterized constructor.
- Getter and Setter methods for all attributes.
- toString(): String: Provides a string representation of the user object.
The Trainee
class represents a trainee entity in the system.
- id (Long): Unique identifier for the trainee.
- dof (LocalDate): Date of birth of the trainee.
- address (String): Address of the trainee.
- userID (Long): User ID associated with the trainee.
- Trainee(): Default constructor.
- Trainee(Long id, LocalDate dof, String address, Long userID): Parameterized constructor.
- Getter and Setter methods for all attributes.
- toString(): String: Provides a string representation of the trainee object.
The Trainer
class represents a trainer entity in the system.
- id (Long): Unique identifier for the trainer.
- trainingType (Long): Identifier for the training type associated with the trainer.
- userId (Long): User ID associated with the trainer.
- Trainer(): Default constructor.
- Trainer(Long id, Long trainingType, Long userId): Parameterized constructor.
- Getter and Setter methods for all attributes.
- toString(): String: Provides a string representation of the trainer object.
The Training
class represents a training entity in the system.
- id (Long): Unique identifier for the training.
- traineeID (Long): User ID associated with the trainee receiving the training.
- trainerID (Long): User ID associated with the trainer providing the training.
- trainingName (String): Name of the training.
- trainingTypeID (Long): Identifier for the type of training.
- trainingDate (LocalDate): Date of the training.
- duration (Number): Duration of the training.
- Training(): Default constructor.
- Training(Long id, Long traineeID, Long trainerID, String trainingName, Long trainingTypeID, LocalDate trainingDate, Number duration): Parameterized constructor.
- Getter and Setter methods for all attributes.
- toString(): String: Provides a string representation of the training object.
The TrainingType
class represents a training type entity in the system.
- id (Long): Unique identifier for the training type.
- name (String): Name of the training type.
- TrainingType(): Default constructor.
- TrainingType(Long id, String name): Parameterized constructor.
- Getter and Setter methods for all attributes.
The AppConfig class serves as the configuration hub for Hibernate integration. It defines a singleton SessionFactory bean, a critical component for managing database connections and interactions.
The UserDAO class is a Hibernate Data Access Object (DAO) implementing CRUD operations for the User entity. It utilizes the SessionFactory to manage database sessions, encapsulating transactional and session logic.
Also, the same implementations on TrainerDAO, TraineeDAO, TrainingDAO, and TrainingTypeDAO.
This project implements a Training Management System with various functionalities related to trainer and trainee profiles, password management, profile updates, activation/deactivation, training sessions, and more.
-
Create Profiles
- Create trainer and trainee profiles associating them with training types and user details.
-
Username and Password Matching
- Verify the matching of usernames and passwords for trainees and trainers.
-
Select Profiles by Username
- Retrieve trainer and trainee profiles based on their respective usernames.
-
Password Change
- Allow secure password changes for both trainees and trainers.
-
Update Profiles
- Modify trainer and trainee profiles while ensuring credentials are valid.
-
Activate/De-activate Profiles
- Enable/disable trainee and trainer profiles.
-
Delete Profiles by Username
- Delete trainee and trainer profiles based on their usernames, with credential validation.
-
Add Training
- Add training sessions with associated trainees, trainers, and other details.
-
Get Trainings List by Username and Criteria
- Retrieve training sessions associated with a specific trainee.
-
Get Trainer Trainings List by Username and Criteria
- Retrieve training sessions associated with a specific trainer.
-
Get Not Assigned Active Trainers List
- Retrieve a list of active trainers not assigned to specific trainees.
-
Profile Creation
- Use provided methods to create trainer and trainee profiles.
-
Username and Password Matching
- Verify username and password combinations for trainees and trainers.
-
Profile Selection
- Retrieve profiles by providing usernames.
-
Password Change
- Change passwords for trainees and trainers.
-
Profile Update
- Modify profiles as needed.
-
Activation/Deactivation
- Activate or deactivate profiles based on criteria.
-
Profile Deletion
- Delete profiles by specifying usernames.
-
Training Management
- Add training sessions and retrieve training lists for trainees and trainers.
-
Trainer Assignment
- Update the list of trainers associated with a specific trainee.
-
List Not Assigned Active Trainers
- Retrieve a list of active trainers not assigned to specific trainees.
Ensure the necessary dependencies, such as the logger and service classes, are configured in the project.
To execute the Java application project utilizing a PostgreSQL relational database, follow these steps:
Create a PostgreSQL database named "hibernate" to facilitate the proper functioning of the application.
After configuring the database, proceed to execute the Java application.