This is a desktop Employee Management System built with Java Swing and Hibernate ORM. It allows you to add, view, update, and delete employee records stored in a MySQL database.
- Features
- Technologies Used
- Project Structure
- Database Setup
- Hibernate Configuration
- Build & Run
- Running Tests
- License
- Add new employees
- View employee details by ID
- Update employee information
- Delete employees
- User-friendly GUI built with Swing
- Hibernate ORM for database operations
- Java 8+
- Swing (GUI)
- Hibernate ORM 7.0.6
- MySQL Connector/J 9.3.0
- Jakarta Persistence API 3.2.0
- Maven
EMSUsingHibernate/
├── src/
│ ├── main/
│ │ └── java/
│ │ ├── hibernate.cfg.xml
│ │ └── com/
│ │ └── kodnest/
│ │ └── EMSUsingHibernate/
│ │ ├── App.java
│ │ ├── Employee.java
│ │ ├── MainFrame.java
│ │ ├── AddEmployeeFrame.java
│ │ ├── ViewEmployeeFrame.java
│ │ ├── UpdateEmployeeFrame.java
│ │ └── DeleteEmployeeFrame.java
│ └── test/
│ └── java/
│ └── com/
│ └── kodnest/
│ └── EMSUsingHibernate/
│ └── AppTest.java
├── pom.xml
└── README.md
Run this query in your MySQL client:
CREATE DATABASE (Database_Name);
Run this query to create the required table:
USE (Database_Name);
CREATE TABLE employee (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
department VARCHAR(50),
salary INT
);
Note: The table will be automatically created if you set
hibernate.hbm2ddl.auto
tocreate
orupdate
in the hibernate configuration.
Update hibernate.cfg.xml
with your MySQL credentials:
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/schema_Name</property>
<property name="hibernate.connection.username">your_username</property>
<property name="hibernate.connection.password">your_password<property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
-
Clone the repository
git clone <repo-url>
-
Build the project
mvn clean install
-
Run the application
Run the main class:
MainFrame
(src/main/java/com/kodnest/EMSUsingHibernate/MainFrame.java
)
Unit tests are in src/test/java/com/kodnest/EMSUsingHibernate/AppTest.java
.
Run tests with:
mvn test
This project is for educational purposes.