profile photo

Amin Amani

Full Stack Developer

| +1 (438) 680 1310
Notre-Dame-de-Grâce, Montreal, QC | AminAmani-Net

Project: JAVA, Hibernate, MySQL

Project Summary

This is a partial Online Shopping System, which can manage Users, Products and Shopping Carts.

This project uses MVC architecture and benefits from multi-layers, with separate packages for the service layer, data access layer, etc.

It was originally a course project with the only requirement of having a one-to-many relationship and CRUD functionalities.

But it has since evolved into a more complete system with many-to-many relations and complex logic, as well as static resource handling, validating user input, interactive user interface, and more.

Code on GitHub Demo

Technologies Used

Backend
JAVA, Spring, Hibernate and MySQL

Frontend
JSP and JavaScript
HTML, CSS, Bootstrap

Screenshots


Details

JAVA Code Snippet

Project Structure

  • The Database diagram and SQL code are available on GitHub.
  • The database table structure is as follows:
    • "User" and "Product" both have one-to-many relationships with "CartItem",
    • "User" has a many-to-many relationship with "Address".
  • One-to-many and many-to-many relationships were implemented using annotations in model classes.
  • Eager Fetching used for CartItems, and Lazy Fetching for Addresses to try both options in practice (From an educational aspect).
JAVA Code Snippet

Java + Hibernate

  • Multiple layers used for the Java code using Model, Service, DAO and Controller packages.
  • User input is validated, in the backend, as well as the frontend.
  • Try-Catch blocks used in controller classes to catch potential input errors and avoid exceptions.
JAVA Code Snippet

Many-To-Many Relationship

All possibilities were considered before executing CRUD operations. For example:

  • Updating user address:
    • if old address was unique to this user
    • if old address belonged to multiple users
    • if new address is unique
    • if new address already exists for the same user
    • if new address already exists for another user
  • Adding user address:
    • if new address already exists for the same user
    • if new address already exists for another user
  • Deleting user address:
    • if address was unique to this user
    • if address belonged to multiple users
JavaScript Code Snippet

Front-end

  • The pages are responsive, although this project focuses on back-end.
  • Bootstrap + jQuery + Font Awesome were added locally to the project via Maven.
  • Static resources folders (JS, CSS, Images) were added to the configuration file.
  • Header, footer and navigation HTML codes are shared between all JSP pages.
  • JavaScript code written from scratch for add/update of table items.

 

Code on GitHub Demo