The below Requirements for a model for Final Bakery Store Project:

  1. Minimum 6 entities
  2. Minimum one inheritance – with 2 subclasses
  3. Minimum one interface with one implementation
  4. Role based model – Eg., Admin and Regular users should have different functionalities
  5. Should implement CRUD functionality for all entities – based on user roles – it should be logical with your model
  6. Should use Java collections for entities relationships. Design your model in such a way that collections are used for associations between entities.
  7. This task is mainly to think logically about the functionalities that a system can perform based on user roles in order to create the design.
  8. DDL statements with Entity relationship diagrams of all the entities.

Classes List:

  • Bakery Items
  • Users
  • Admin
  • Customers
  • Order
  • Account

Interface

  • Payment

Class Relationship:

  • Bakery_Items to Account (MANY TO ONE)
  • USER to ACCOUNT(ONE TO ONE)
  • Customer and Admin are subclasses of User(inheritance)
  • User to Orders(ONE to MANY)
  • Account to Orders(ONE to MANY)
  • Payment<interface> to Orders(One to Many)

UML Diagram for Bakery Store

Database Table List

  • Bakery_items
  • Users
  • Account
  • Orders

DDL Statements:

Table Bakeryitems

Create Table BakeryItems

  • Item_id number(10) NOT NULL,
  • item_name varchar(50) NOT NULL,
  • price number(10),
  • DateOfManufacturing DATE,
  • CONSTRAINT BakeryItems_pk PRIMARY KEY (item_id),

Create Table Account

  • Account_id number(10) NOT NULL,
  • Customer_username varchar(50) NOT NULL,
  • customer_id number(10),
  • CONSTRAINT Account_pk PRIMARY KEY (Account_id),
  • CONSTRAINT fk_User
  • FOREIGN KEY (User_id)

Create Table User

  • User_id number(10) NOT NULL,
  • username  varchar(50) NOT NULL,
  • password  varchar2(10),
  • email  varchar2(10),
  • phone  Number(10),
  • Account_id varchar2(10),
  • CONSTRAINT Customer_pk PRIMARY KEY (customer_id),
  • CONSTRAINT fk_Account
  • FOREIGN KEY (Account_id) 

Create Table Order

  • Order_id number(10) NOT NULL,
  • item_name  varchar(50) ,
  • item_id  Number(10),
  • order_date varchar2(10),
  • payment_id  Number(10)
  • CONSTRAINT Order_pk PRIMARY KEY (Order_id),
  • CONSTRAINT fk_Bakery_Item
  • FOREIGN KEY (Item_id)