This is a simple Employee Management System built using Java and SQL. The project follows a layered architecture pattern, which includes the following layers:
-
Domain Layer: This layer contains the
Employeeclass, which is a simple Java class that represents theEmployeeentity in our application. -
DAO Layer: This layer is responsible for interacting with the database. It contains the
EmployeeDaointerface and its implementationEmployeeDaoImpl. TheEmployeeDaointerface extends theDaointerface, which defines the basic CRUD operations. TheEmployeeDaoImplclass implements these operations using JDBC. -
Service Layer: This layer contains the
EmployeeServiceinterface and its implementationEmployeeServiceImpl. TheEmployeeServiceinterface defines the same CRUD operations as theDaointerface. TheEmployeeServiceImplclass implements these operations by delegating the work to an instance ofEmployeeDao. -
Controller Layer: This layer contains the
EmployeeControllerclass, which is responsible for handling user requests and delegating the work to theEmployeeService. -
Main Application: This is the entry point of our application. It uses the
EmployeeControllerto perform CRUD operations onEmployeeentities.
-
The Main Application interacts with the Controller Layer. It creates an instance of
EmployeeControllerand uses it to perform CRUD operations onEmployeeentities. -
The Controller Layer interacts with the Service Layer. The
EmployeeControllerhas an instance ofEmployeeService, which it uses to perform CRUD operations. When theEmployeeControllerreceives a request from the Main Application, it delegates the work to theEmployeeService. -
The Service Layer interacts with the DAO Layer. The
EmployeeServiceImplhas an instance ofEmployeeDao, which it uses to interact with the database. When theEmployeeServiceImplreceives a request from theEmployeeController, it delegates the work to theEmployeeDao. -
The DAO Layer interacts with the Database. The
EmployeeDaoImpluses JDBC to execute SQL queries against the database. -
The Domain Layer is used by all other layers. The
Employeeclass is used to representEmployeeentities throughout the application.
- Clone the repository.
- Open the project in your favorite IDE (the project is set up for IntelliJ IDEA).
- Make sure you have a MySQL server running and adjust the database connection parameters in the
Databaseclass if necessary. - Run the
Mainclass.
Please note that this is a simple example and does not include any error handling or input validation. It's meant to demonstrate the basic structure of a layered architecture in a Java application.