A console-based hostel/dormitory management system written in Java, backed by MySQL. It's a learning project built to practice core Java, JDBC, and layered application design (menu -> service -> DAO), with an eye towards eventually growing into a full web application.
There are two kinds of users: students and admins.
Students can:
- Create an account (name, registration number, username, email, phone, gender, password)
- Log in
- Apply for a hostel/room allocation (if they don't have a bed yet)
- Request a room transfer (if they already have a bed and want a different one)
Admins can:
- Register hostels (name + gender type, since hostels are gender-segregated)
- Register rooms within a hostel
- Add beds to a room
- Review pending student requests and approve or reject them
- Handle allocations: for an approved request, pick a hostel matching the student's gender, then an available bed, and assign it — freeing the student's previous bed first if it's a transfer
- Java 25 (Maven,
pom.xml) - MySQL (via
mysql-connector-j) - jBCrypt for password hashing
- Plain JDBC (no ORM) with a simple DAO -> Service -> Menu layering
src/main/java/com/ejaisoft/
HostelSystem.java entry point
Utils/ SystemSettings (DB connection), PasswordUtil, Validator
model/ Student, Admin, Hostel, Room, Bed, Request, and enums
dao/ JDBC data access, one class per table
service/ business rules and validation, sits between menus and DAOs
menu/ console UI (MainMenu, LoginMenu, AdminMenu, StudentMenu)
src/main/resources/
db.properties.example copy to db.properties (gitignored) and fill in your credentials
sql/ schema notes/fixes for tables not covered by an ORM migration tool
src/test/java/
SeedAdmin.java one-off utility to create the first admin account
DbMapTest.java ad hoc manual test scratchpad
- Have MySQL running with a
hostel_systemdatabase containingstudent,hostel,room,bed,admin, andrequeststables (seesrc/main/resources/sql/for the admin table and a couple of schema fixes that were needed). - Copy
src/main/resources/db.properties.exampletodb.propertiesin the same folder and fill in your MySQL URL/username/password. - Seed an admin account (one-time):
Creates username
mvn test-compile exec:java -Dexec.mainClass=SeedAdminadmin/ passwordChangeMe123!— log in with that once, then change it (see Future Improvements). - Run the app:
or run
mvn compile exec:javaHostelSystem.javadirectly from your IDE.
Roughly in order of what would matter most next:
- Web version — swap the console
menulayer for a web framework (Spring Boot is the natural fit given the existing service/DAO layering barely changes) with proper sessions instead of passing objects between menu calls. - Change/reset password — there's currently no way to change a password after account creation, for students or admins.
- View my allocation — students can apply/transfer but can't currently see their own current hostel/room/bed from the menu; it's only visible via the DB.
- Hostel change requests —
RequestType.HOSTEL_CHANGEexists in the model/schema but isn't wired to any menu option yet. - Admin-side room/bed editing — updating or removing a room/bed once created isn't supported yet, only adding.
- Pagination/filtering for listings (hostels, rooms, requests) once the data set grows past what fits on one screen.
- Automated tests — there's no test suite yet beyond manual/scripted runs; the service layer is the natural place to start (it's already decoupled from the console I/O).
- Migration tool (e.g. Flyway) instead of the plain
.sqlfiles insrc/main/resources/sql/, once the schema starts changing more often.