This project is an implementation of the DAO (Data Access Object) pattern in Java, using JDBC (Java Database Connectivity) to interact with a MySQL database. The DAO pattern is an approach to organize the persistence layer in an application, separating data access operations from business logic.
The project consists of a simple management system for sellers and departments. It allows performing basic CRUD (Create, Read, Update, Delete) operations for sellers and departments, storing the data in a MySQL database.
The project offers the following features:
- Query seller by ID.
- Query all sellers.
- Query sellers by department.
- Insert new seller.
- Update seller data.
- Delete a seller.
The project is organized into packages, with the following structure:
src
: Contains the packages and classes of the project.model.entities
: Contains the entity classes of the system.Department
: Represents the Department entity.Seller
: Represents the Seller entity.
model.dao
: Contains the interfaces for the DAO classes.DepartmentDao
: Interface for the Department DAO.SellerDao
: Interface for the Seller DAO.
model.dao.impl
: Contains the implementations of the DAO interfaces.DepartmentDaoJDBC
: Implementation of the Department DAO using JDBC.SellerDaoJDBC
: Implementation of the Seller DAO using JDBC.
db
: Contains the classes related to the database connection.DB
: Utility class for configuring the database connection.DbException
: Custom exception for handling database errors.DaoFactory
: Class for instantiating DAOs.
db.properties
: Configuration file with the database access information.Demo.java
: Demonstration class with examples of using the functionalities.
- Clone the project repository to your local environment.
- Configure the
db.properties
file with the access information to your MySQL database. - Import the project into your preferred Java IDE (such as Eclipse or IntelliJ).
- Ensure that the dependencies are correctly configured (e.g., MySQLConnector).