A simple Java console application to manage restaurant records using JDBC and MySQL. It supports basic CRUD operations with a clean multi-layered architecture.
RestaurantProject/
├── build.bat
├── README.md
│
├── lib/
│ ├── mysql-connector-java-8.0.xx.jar
│ ├── log4j-api-2.x.jar
│ └── log4j-core-2.x.jar
│
├── resources/
│ └── log4j2.xml
│
├── logs/
│ └── app.log
│
├── src/
│ └── RestaurantProject/
│ ├── model/
│ │ ├── Restaurant.java
│ │ ├── Customer.java
│ │ ├── Employee.java
│ │ ├── Menu.java
│ │ ├── Order.java
│ │ ├── PaymentTransaction.java
│ │ └── CustomerReview.java
│ ├── repository/
│ │ └── RestaurantRepo.java
│ ├── service/
│ │ └── RestaurantService.java
│ ├── util/
│ │ └── RestaurantConstants.java
│ └── Main.java
│
├── bin/
build.bat– Batch script to compile all Java files and run the program.README.md– Project documentation and usage guide.
mysql-connector-j-9.x.x.jar– MySQL JDBC driver for database connectivity.log4j-api-2.x.x.jar– Log4j 2 API for logging.log4j-core-2.x.x.jar– Log4j 2 Core implementation.
log4j2.xml– Configuration file for Log4j 2 logging.
app.log- Generated runtime log file.
Restaurant.java– POJO class for restaurant entity.Customer.java– POJO representing customer details.Employee.java– POJO representing employee data.Menu.java– POJO for menu items.Order.java– POJO representing customer orders.PaymentTransaction.java– POJO for payment transaction details.CustomerReview.java– POJO for customer reviews and ratings.
RestaurantRepo.java– Contains JDBC code to interact with the restaurant database (CRUD operations).
RestaurantService.java– Business logic layer that calls repository functions and provides service-level operations.
RestaurantConstants.java– Stores constants like DB URL, username, password, and JDBC driver class.
- Entry point of the application; contains the
main()method for running the program and testing service methods.
- Compiled class files
- Install MySQL and create a
restaurantdatabase. - Add your DB credentials to
util/RestaurantConstants.java. - Place the MySQL JDBC driver
.jarfile in thelib/folder. - Run
build.batto compile and execute the application.
💡 Make sure Java is added to your system
PATH.
Restaurant
- Get all restaurants
- Get restaurant by ID
- Create a new restaurant
- Delete restaurant by ID or by ID + Name
- Update restaurant by ID
- Update GST number by restaurant type
- Java 8+
- JDBC
- MySQL
- MySQL Connector/J (JDBC Driver)
- Apache Log4j2 for logging
List<Restaurant> list = RestaurantService.getRestaurants();
Restaurant newRestaurant = new Restaurant();
newRestaurant.setName("Spice Villa");
newRestaurant.setLocation("Hyderabad");
newRestaurant.setGstNo("GST1234");
newRestaurant.setDate("2020-01-01");
RestaurantService.createRestaurant(newRestaurant);Developed by Rajeev Telagasetti.
Feel free to fork, use, or contribute to this project!
