Skip to content

Latest commit

Β 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hotel Management System Banner

🏨 Hotel Management System Using JDBC

A Backend-Focused Java Application built using Java, JDBC, and MySQL, following a clean Layered Architecture.

Java JDBC MySQL Architecture Repository Pattern

Built to strengthen my Java Backend Development skills by implementing JDBC connectivity, clean software architecture, and database-driven application design.


πŸ“– Overview

This project is a console-based Hotel Management System developed to strengthen my understanding of Java Backend Development using JDBC and MySQL.

Instead of focusing only on implementing CRUD operations, this project emphasizes writing clean, maintainable, and well-structured backend code by following a Layered Architecture and Repository Pattern.

The application demonstrates how a Java application communicates with a relational database while maintaining a clear separation between presentation, business logic, and data access.

Throughout the development of this project, I focused on applying software engineering principles that are commonly used in backend applications.


✨ Features

🏨 Reservation Management

  • Create hotel reservations with automatic room allocation.
  • View reservation details using Reservation ID.
  • Vacate reservations while automatically updating room availability.
  • Display only active reservations by excluding vacated records.

πŸ” Smart Search

  • Search rooms using guest names.
  • Case-insensitive search.
  • Partial name matching using Java Streams API.

πŸšͺ Room Management

  • Automatically allocates available rooms.
  • Updates room status after reservation.
  • Restores room availability after checkout.
  • Displays real-time room occupancy status.

πŸ—„οΈ Database Utilities

  • Password-protected database reset utility.
  • Clears reservation history.
  • Resets every room to AVAILABLE.
  • Designed for development and testing.

πŸ–₯️ Console Experience

  • Clean console interface.
  • Formatted tables and reports.
  • User-friendly navigation.
  • Utility-based screen transitions.

πŸ› οΈ Tech Stack

Technology Purpose
Java 26 Core application development
JDBC Database connectivity
MySQL Relational database
Java Streams API Searching and filtering
Collections Framework Data handling
OOP Application design
Layered Architecture Separation of concerns
Repository Pattern Data access abstraction

🧠 Concepts Demonstrated

Java Fundamentals

  • Object-Oriented Programming (OOP)
  • Encapsulation
  • Abstraction
  • Interfaces
  • Collections Framework
  • Java Streams API
  • Exception Handling

Backend Development

  • JDBC Connectivity
  • CRUD Operations
  • Repository Pattern
  • Service Layer
  • Layered Architecture
  • Separation of Concerns
  • Database State Management

Database

  • MySQL
  • SQL
  • Primary Keys
  • Auto Increment
  • Timestamp Handling
  • Relational Data Modeling

🎯 Learning Outcomes

Through this project I gained practical experience in:

  • Designing layered Java applications.
  • Building reusable Service and Repository layers.
  • Connecting Java applications with MySQL using JDBC.
  • Managing application state through SQL operations.
  • Writing clean and maintainable backend code.
  • Using Java Streams for searching and filtering.
  • Structuring projects similar to real-world backend applications.

More importantly, this project helped me understand why software architecture matters, rather than simply learning how to write Java code.


πŸ—οΈ Project Architecture

This project follows a Layered Architecture, where each layer has a clearly defined responsibility. This design improves maintainability, readability, testability, and allows future enhancements without affecting the entire application.

                           User
                             β”‚
                             β–Ό
                    Presentation Layer
                         (Main.java)
                             β”‚
                             β–Ό
                      Service Layer
                 (Business Logic & Workflow)
                             β”‚
                             β–Ό
                    Repository Layer
               (JDBC Database Operations)
                             β”‚
                             β–Ό
                       MySQL Database

πŸ“Œ Layer Responsibilities

Layer Responsibility
Presentation Layer Handles user interaction, menu navigation, input collection, and formatted console output.
Service Layer Implements business rules, coordinates workflows, validates requests, and communicates with repositories.
Repository Layer Executes SQL queries using JDBC and performs all database operations.
Database Layer Stores room information, reservations, and reservation history.

πŸ”„ Request Flow

Every user request follows the same execution pipeline.

User
   β”‚
   β–Ό
Presentation Layer (Main)
   β”‚
   β–Ό
ReservationService
   β”‚
   β–Ό
Repository Layer
   β”‚
   β–Ό
JDBC
   β”‚
   β–Ό
MySQL Database
   β”‚
   β–Ό
Repository
   β”‚
   β–Ό
Service
   β”‚
   β–Ό
Presentation Layer
   β”‚
   β–Ό
Console Output

This workflow ensures that:

  • The UI never executes SQL directly.
  • Business rules remain inside the Service layer.
  • Database access is isolated inside repositories.
  • Responsibilities remain separated throughout the application.

πŸ“‚ Project Structure

Hotel-Management-System-Using-JDBC
β”‚
β”œβ”€β”€ assets
β”‚   β”œβ”€β”€ banner.png
β”‚   β”œβ”€β”€ make-reservation.gif
β”‚   β”œβ”€β”€ view-reservation.gif
β”‚   β”œβ”€β”€ delete-reservation.gif
β”‚   β”œβ”€β”€ list-active-reservations.gif
β”‚   β”œβ”€β”€ get-room-number.gif
β”‚   β”œβ”€β”€ room-status.gif
β”‚   └── clear-database.mp4
β”‚
β”œβ”€β”€ database
β”‚   β”œβ”€β”€ hotelDB.sql
β”‚   └── README.md
β”‚
β”œβ”€β”€ lib
β”‚   └── mysql-connector-j.jar
β”‚
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ app
β”‚   β”‚     └── Main.java
β”‚   β”‚
β”‚   β”œβ”€β”€ config
β”‚   β”‚     β”œβ”€β”€ database.properties.example
β”‚   β”‚     └── database.properties (ignored by Git)
β”‚   β”‚
β”‚   β”œβ”€β”€ domain
β”‚   β”‚     β”œβ”€β”€ Reservation.java
β”‚   β”‚     └── Room.java
β”‚   β”‚
β”‚   β”œβ”€β”€ repository
β”‚   β”‚     β”œβ”€β”€ ReservationRepository.java
β”‚   β”‚     └── RoomRepository.java
β”‚   β”‚
β”‚   β”œβ”€β”€ service
β”‚   β”‚     β”œβ”€β”€ ReservationService.java
β”‚   β”‚     └── implementation
β”‚   β”‚            └── ReservationServiceImpl.java
β”‚   β”‚
β”‚   └── util
β”‚         β”œβ”€β”€ ConsoleUtil.java
β”‚         β”œβ”€β”€ DBConnection.java
β”‚         └── ResultsCarrier.java
β”‚
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
└── .gitignore

πŸ“¦ Package Overview

Package Description
app Entry point of the application. Handles menus, user interaction, and console presentation.
config Contains database configuration files and environment-specific settings.
domain Contains entity classes such as Reservation and Room.
repository Responsible for all JDBC operations and SQL execution.
service Contains business logic and coordinates workflows between UI and repositories.
util Shared helper classes for database connectivity, console utilities, and result wrappers.

πŸ—„οΈ Database Design

The application uses MySQL with three relational tables.


πŸ“‹ roomsT

Stores information about every room available in the hotel.

Column Type Description
roomNumber INT Unique room number
status VARCHAR AVAILABLE / OCCUPIED

πŸ“‹ reservationT

Stores all reservation records.

Column Type Description
reservationId INT Auto-generated reservation ID
roomNumber INT Allocated room number
name VARCHAR Guest name
contactNumber VARCHAR Guest contact number
reservationDate TIMESTAMP Reservation creation timestamp

πŸ“‹ vacatedUsers

Maintains reservation history after checkout.

Instead of permanently deleting reservation information, vacated reservations are tracked separately, allowing the application to display only active reservations while preserving historical records.

Column Type Description
reservationId INT Vacated reservation ID
vacatedDate TIMESTAMP Checkout timestamp

πŸ’‘ Design Decisions

Several architectural decisions were intentionally taken while building this project:

  • Separation of concerns through Layered Architecture.
  • Repository Pattern to isolate database operations.
  • JDBC used directly to strengthen backend fundamentals.
  • Console-based UI to focus entirely on backend development.
  • Configuration moved to external properties instead of hardcoding credentials.
  • Utility classes created for reusable functionality and cleaner code organization.

These decisions helped create a maintainable codebase while providing hands-on experience with real-world backend application design.


πŸš€ Feature Demonstration

The following demonstrations showcase the primary workflows of the application and how each feature interacts with the backend.


🏨 1. Create Reservation

Automatically allocates the next available room, stores the reservation in the database, and updates the room status to OCCUPIED.


πŸ“‹ 2. View Reservation

Retrieve complete reservation information using the generated Reservation ID.


❌ 3. Vacate Reservation

Vacates a reservation and automatically changes the corresponding room status back to AVAILABLE.


πŸ“‘ 4. List Active Reservations

Displays only active reservations by excluding vacated reservations using the vacatedUsers table.


πŸ” 5. Search Room by Guest Name

Uses the Java Streams API to perform a case-insensitive search and return the allocated room number(s).


πŸšͺ 6. Room Status Dashboard

Displays the current occupancy status of every room in the hotel.


πŸ—„οΈ 7. Database Reset Utility

For development and testing purposes, the application includes a password-protected database reset utility.

This utility:

  • Clears reservation records.
  • Clears vacated reservation history.
  • Restores every room to the AVAILABLE state.
  • Resets the application to its initial state.

πŸŽ₯ Complete Demonstration

➑️ Watch Database Reset Demo


βš™οΈ Behind the Scenes

Every feature demonstrated above follows the same backend workflow.

                    User
                      β”‚
                      β–Ό
              Presentation Layer
                  (Main.java)
                      β”‚
                      β–Ό
               Reservation Service
            (Business Logic Layer)
                      β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β–Ό                       β–Ό
 ReservationRepository      RoomRepository
          β”‚                       β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
                     JDBC
                      β”‚
                      β–Ό
                MySQL Database

This architecture keeps:

  • SQL isolated inside the Repository layer.
  • Business rules inside the Service layer.
  • User interaction inside the Presentation layer.

As a result, each layer has a single responsibility, making the project easier to maintain and extend.


πŸš€ Getting Started

Follow the steps below to set up and run the project locally.


πŸ“‹ Prerequisites

Before running the application, ensure the following software is installed:

  • Java JDK 26 (or later)
  • MySQL Server
  • MySQL Connector/J
  • Visual Studio Code (or any Java IDE)

πŸ“₯ Clone the Repository

git clone https://github.com/ateeburrahaman3/Hotel-Management-System-Using-JDBC.git

cd Hotel-Management-System-Using-JDBC

πŸ—„οΈ Database Setup

Step 1

Open your MySQL server.


Step 2

Import the SQL script located at:

database/hotelDB.sql

The script automatically creates:

  • hotelDB
  • roomsT
  • reservationT
  • vacatedUsers

and inserts the initial room records required by the application.


Step 3

Open:

src/config/database.properties

Update the following values according to your local MySQL installation:

db.url=jdbc:mysql://localhost:3306/hotelDB
db.user=your_username
db.password=your_password

admin.password=your_admin_password

▢️ Run the Application

Compile and execute:

src/app/Main.java

The application launches with an interactive console interface.

====================================================
            HOTEL MANAGEMENT SYSTEM
====================================================

1. Make Reservation
2. View Reservation
3. Delete Reservation
4. List Active Reservations
5. Search Room by Guest Name
6. Room Status
0. Exit

πŸ“ Project Resources

Resource Description
assets/ Banner, GIF demonstrations, and walkthrough videos
database/ SQL initialization script and setup guide
src/ Complete application source code
lib/ MySQL JDBC Driver

βš™οΈ Configuration

This project is intentionally built without Maven or Gradle to strengthen understanding of core Java project structure and manual dependency management.

Configuration is externalized using:

src/config/database.properties

which stores:

  • Database URL
  • Database Username
  • Database Password
  • Admin Password

The sample configuration is provided in:

src/config/database.properties.example

allowing anyone to configure the project without exposing sensitive credentials.


πŸš€ Future Improvements

While this project successfully demonstrates the fundamentals of Java backend development using JDBC, there are several enhancements that could further improve its scalability, maintainability, and production readiness.

Backend Improvements

  • Implement transaction management for multi-step database operations.
  • Add centralized logging using a logging framework.
  • Improve exception handling with custom exception classes.
  • Introduce foreign key constraints for stronger database integrity.
  • Externalize all application configuration and environment variables.

Feature Enhancements

  • Reservation update functionality.
  • Room categories and pricing management.
  • Billing and invoice generation.
  • Reservation history and reporting.
  • Advanced search and filtering.
  • User authentication and role-based authorization.

Technical Enhancements

  • Migrate to Spring Boot.
  • Replace raw JDBC with Spring Data JPA / Hibernate.
  • Build RESTful APIs.
  • Add Unit and Integration Testing using JUnit.
  • Dockerize the application.
  • Implement CI/CD using GitHub Actions.

πŸ“š What I Learned

Developing this project significantly strengthened my understanding of backend application development.

Throughout the implementation, I gained practical experience in:

  • Designing applications using Layered Architecture.
  • Applying the Repository Pattern.
  • Separating Presentation, Service, and Repository responsibilities.
  • Connecting Java applications with MySQL using JDBC.
  • Writing SQL queries for real-world CRUD operations.
  • Managing application state through relational databases.
  • Building reusable utility classes.
  • Using Java Streams for efficient data processing.
  • Structuring backend projects for maintainability and scalability.

More importantly, this project helped me understand why clean software architecture matters, rather than simply learning how to write Java code.


🎯 Project Goals

This project was built with the following objectives:

  • Strengthen Java backend fundamentals.
  • Gain hands-on experience with JDBC.
  • Understand how layered applications are structured.
  • Practice clean coding principles.
  • Build a portfolio-ready backend project.
  • Establish a strong foundation before moving to Spring Boot and enterprise backend development.

πŸ‘¨β€πŸ’» About the Developer

Hi, I'm Ateeb Ur Rahaman.

I'm an Electronics and Communication Engineering graduate with a strong interest in Java Backend Development, Software Engineering, and Artificial Intelligence.

I enjoy building projects that help me understand how real-world backend systems are designedβ€”from database interaction and software architecture to scalable application development.

My current learning roadmap includes:

  • Spring Boot
  • REST APIs
  • Hibernate
  • Docker
  • Microservices
  • Generative AI

This project represents an important milestone in my journey toward becoming a Backend Developer.


🀝 Let's Connect

I'm always open to connecting with developers, recruiters, and anyone interested in backend development.

πŸ“§ Email
ateeburrahaman3@gmail.com

πŸ”— LinkedIn
https://www.linkedin.com/in/ateeb-ur-rahaman/

πŸ™ GitHub
https://github.com/ateeburrahaman3


πŸ“„ License

This project is licensed under the MIT License.

You are welcome to use, study, modify, and learn from this project in accordance with the terms of the license.

For more information, see the LICENSE file.


⭐ Thank You for Visiting!

If you found this project useful or interesting, please consider giving it a ⭐ on GitHub.

Your feedback, suggestions, and contributions are always welcome.


πŸš€ Currently Learning

Java Backend Development β€’ Spring Boot β€’ REST APIs β€’ Docker β€’ Generative AI


"Every project is another step toward becoming a better software engineer."

About

A backend-focused Hotel Management System built using Java, JDBC, and MySQL, showcasing Layered Architecture, Repository Pattern, and clean software design principles.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages