Java 12
Java 12
Introduction...................................................................................................................... 3
[Link] normalization.............................................................................................3
2.1 unnormalized form.............................................................................................. 3
2.2 third normal form.................................................................................................3
3 table attributes...............................................................................................................3
3.1 role..........................................................................................................................3
3.2 User........................................................................................................................ 4
3.3 Student profile........................................................................................................ 4
3.4 Recruiter profile...................................................................................................... 5
3.5 Category................................................................................................................. 6
3.6 Job..........................................................................................................................7
3.7 application.............................................................................................................. 8
3.8 complaint................................................................................................................ 9
3.9 content..................................................................................................................10
3.10 audit log.............................................................................................................. 10
4. Data Dictionary...........................................................................................................11
4.2 user.......................................................................................................................12
4.3 student profile.......................................................................................................13
4.4 recruiter profile......................................................................................................14
4.5 category................................................................................................................16
4.6 job.........................................................................................................................16
4.7 Application............................................................................................................18
4.8 complaint.............................................................................................................. 19
4.9 complaint.............................................................................................................. 21
4.10 audit log.............................................................................................................. 21
5. redundancy elimination..............................................................................................22
5.1 Role Name Redundancy (resolved by role table).................................................22
5.2 Category Name Redundancy (Resolved by category table)................................22
5.3 Company Details Redundancy (Resolved by recruiter_profile)............................22
5.4 Student Details Redundancy (Resolved by student_profile).................................23
5.5 Duplicate Application Prevention (UNIQUE constraint)........................................23
5.6 Duplicate Wishlist Prevention (UNIQUE constraint).............................................23
5.7 CMS Page Redundancy (UNIQUE constraint on page_name)............................23
5.8 Password Storage (No duplication, no plain text).................................................24
5.9 Audit Log Integrity (SET NULL on cascade).........................................................24
5.10 Summary of All Redundancy Resolutions..........................................................24
6. Conclusion................................................................................................................. 25
Introduction
This document outlines the entire database design of the Campus Job Portal System - a
J2EE/JSP web application that links students, recruiters and administrators to
modernize campus recruitment in Nepal, especially in institutions such as Itahari
International College.
The database, called campus job portal, is implemented in MySQL using the InnoDB
storage engine with the utf8mb4 character set to support Unicode text including Nepali
characters. It has eleven tables, the structure of which was obtained after a formal
normalization process (UNF → 1NF → 2NF → 3NF).
This document covers:
Sequential normalization of unnormalized raw data to the 3NF-compliant tables.
Table attributes: column names, data types and constraints as they are actually defined
in the SQL schema.
A data dictionary that is detailed with business rules on all attributes.
How and why redundancy is removed during the design is explained.
[Link] normalization
Normalization is the process of ensuring the relational tables are structured in a way
that data redundancy is minimized and the level of integrity is enhanced. Beginning with
a conceptual flat record that captures all the interactions of a student with the portal,
one normal form is applied at a time.
3 table attributes
3.1 role
Lookup table for the three user roles in the system. Removed in the 3NF normalization
of the user table to remove the transitive dependency user id = role id = role name.
Column Name Data Type Constraints Description
role_id INT(11) PK, Surrogate primary
AUTO_INCREMENT, key for the role
NOT NULL
role_name VARCHAR(50) UNIQUE, NOT NULL One of: Admin,
Student, Recruiter
3.2 User
Central authentication table. Has a single login account per user irrespective of position.
The role_id foreign key is connected to the role table which was pulled out during 3NF
normalization.
Column Name Data Type Constraints Description
user_id INT(11) PK, Surrogate primary key
AUTO_INCREMENT,
NOT NULL
full_name VARCHAR(100 NOT NULL Full legal name —
) letters and spaces only
(validated in
UserService)
email VARCHAR(100 UNIQUE KEY Login email — globally
) idx_email, NOT NULL unique across all roles
password_has VARCHAR(255 NOT NULL SHA-256 hashed
h ) password — plain text
never stored
role_id INT(11) FK → role(role_id), Determines system role
NOT NULL (Admin/Student/Recruite
r)
is_approved TINYINT(1) NOT NULL, DEFAULT 0 = pending admin
0 approval; 1 = active
account
created_at TIMESTAMP NOT NULL, DEFAULT Account creation
CURRENT_TIMESTAM timestamp — set once,
P never updated
last_login TIMESTAMP NULL, DEFAULT NULL Updated each time user
successfully logs in
3.5 Category
Table of job categories. Obtained in the 3NF normalization to eliminate the transitive
dependency job id → category id category name.
Column Name Data Type Constraints Description
category_id INT(11) PK, Surrogate
AUTO_INCREMENT category key
, NOT NULL
category_name VARCHAR(50) UNIQUE KEY, NOT e.g., Information
NULL Technology,
Finance,
Internship
description VARCHAR(255) DEFAULT NULL Short explanation
of what roles fall
under this
category
3.6 Job
Archives all job advertisements which recruiters place. The user table (through
recruiter_id) and the category table (through category_id) are referred to. Added in the
process of 2NF decomposition; category_id FK added in the process of 3NF.
Column Name Data Type Constraints Description
job_id INT(11) PK, Surrogate job
AUTO_INCREMENT, key
NOT NULL
recruiter_id INT(11) FK → user(user_id), Recruiter who
NOT NULL owns this
posting
category_id INT(11) FK → Job category —
category(category_id), SET NULL if
NULL category
deleted
title VARCHAR(100) NOT NULL Job title (max
100 chars)
description TEXT NOT NULL Full job
description
including
responsibilities
eligibility TEXT DEFAULT NULL Academic or
skills
requirements
for applicants
salary_min DECIMAL(10,2) DEFAULT NULL Minimum
monthly salary
in NPR (NULL =
not disclosed)
salary_max DECIMAL(10,2) DEFAULT NULL Maximum
monthly salary
in NPR
location VARCHAR(100) NOT NULL Work location or
'Remote'
application_deadlin DATE NOT NULL Applications
e closed after this
date
is_active TINYINT(1) NOT NULL, DEFAULT 1 1 = visible to
students; 0 =
deactivated
posted_date TIMESTAMP NOT NULL, DEFAULT Exact
CURRENT_TIMESTAM timestamp the
P job was created
3.7 application
Logs all student application events. The composite UNIQUE KEY of (student_id, job_id)
helps to avoid duplicate applications on the database level and it is complemented with
the duplicate check on the service-layer in ApplicationService.
Column Name Data Type Constraints Description
application_id INT(11) PK, Surrogate
AUTO_INCREMENT, application key
NOT NULL
student_id INT(11) FK → user(user_id), Student who
NOT NULL submitted this
application
job_id INT(11) FK → job(job_id), NOT Job being applied
NULL for
status ENUM NOT NULL, DEFAULT PENDING,
'PENDING' REVIEWED,
SHORTLISTED,
REJECTED,
HIRED
applied_date TIMESTAMP NOT NULL, DEFAULT Timestamp of
CURRENT_TIMESTAMP application
submission
recruiter_notes TEXT DEFAULT NULL Private notes
added by the
recruiter
UNIQUE KEY — idx_unique_application Prevents duplicate
(student_id,job_id) applications at DB
level
3.8 complaint
Complaints made by any user (students or recruiters) in respect of fake account or
fraudulent job listing. Status can be updated and responded to by the Admin.
Column Name Data Type Constraints Description
application_id INT(11) PK, Surrogate
AUTO_INCREMENT, application key
NOT NULL
student_id INT(11) FK → user(user_id), Student who
NOT NULL submitted this
application
job_id INT(11) FK → job(job_id), NOT Job being applied
NULL for
status ENUM NOT NULL, DEFAULT PENDING,
'PENDING' REVIEWED,
SHORTLISTED,
REJECTED,
HIRED
applied_date TIMESTAMP NOT NULL, DEFAULT Timestamp of
CURRENT_TIMESTAMP application
submission
recruiter_notes TEXT DEFAULT NULL Private notes
added by the
recruiter
UNIQUE KEY — idx_unique_application Prevents duplicate
(student_id,job_id) applications at DB
level
3.9 content
CMS table under the control of AdminContentServlet. Editable text is stored in stores
that can be viewed by other people (About, Contact, Privacy, Terms). The page_name
UNIQUE KEY makes sure that each page contains only one content record.
Column Name Data Type Constraints Description
content_id INT(11) PK, Surrogate
AUTO_INCREMENT, content key
NOT NULL
page_name VARCHAR(50) UNIQUE KEY, NOT Slug identifier:
NULL 'about', 'contact',
'privacy', 'terms'
title VARCHAR(200) NOT NULL Page heading
displayed to
visitors
body TEXT NOT NULL HTML body
content of the
page
last_updated TIMESTAMP NOT NULL, ON Auto-updated
UPDATE whenever admin
CURRENT_TIMESTAMP saves the page
updated_by INT(11) FK → user(user_id), Admin user who
NULL (SET NULL) last edited the
page
4. Data Dictionary
The data dictionary gives an all-inclusive authoritative source of all attributes in the
schema of the campus_job_portal. It captures the domain, constraints, default values
and business rules that operate on each column. This is the sole source of truth of all
developers working on the Campus Job Portal System.
4.1 role
Attribute Type / Size Null? Default Business
Rule / Notes
role_id INT(11) No AUTO_INC System-
generated.
Never reused.
Referenced by
user.role_id as
a foreign key.
role_name VARCHAR(50) No — Allowed
values:
'Admin',
'Student',
'Recruiter'.
UNIQUE
constraint
prevents
duplication.
Seeded at DB
creation.
4.2 user
Attribute Type / Size Null Default Business Rule / Notes
?
user_id INT(11) No AUTO_IN Surrogate PK. Referenced by
C student_profile, recruiter_profile,
job, application, wishlist,
complaint, content, audit_log.
full_name VARCHAR(10 No — Must contain only letters and
0) spaces. Numbers rejected by
[Link]
ds(). Max 100 chars.
email VARCHAR(10 No — Standard email format. Globally
0) unique (idx_email). Stored in
lowercase. Used as the login
identifier.
password_ha VARCHAR(25 No — SHA-256 hex digest. Plain-text
sh 5) password never persisted.
Hashed in PasswordUtil before
any INSERT or UPDATE.
role_id INT(11) No — FK → role(role_id). ON DELETE
CASCADE. Determines which
dashboard and permissions the
user sees.
is_approved TINYINT(1) No 0 0 = account pending admin
approval. 1 = active and may log
in. Suspended accounts have
is_approved set back to 0.
created_at TIMESTAMP No NOW() Set at INSERT. Immutable. Used
in admin registration reports.
last_login TIMESTAMP Yes NULL Updated on every successful
login. NULL means user has
never logged in since account
creation.
4.5 category
Attribute Type / Size Null? Default Business Rule /
Notes
category_id INT(11) No AUTO_INC Surrogate PK.
Referenced by
job.category_id.
category_nam VARCHAR(50) No — Must be
e unique. 8
values seeded
at DB creation.
Admin can add
more via CMS.
description VARCHAR(255) Yes NULL Optional plain-
text description
shown in the
category
management
panel.
4.6 job
Attribute Type / Size Null? Default Business Rule / Notes
job_id INT(11) No AUTO_INC Surrogate PK.
Referenced by
application.job_id and
wishlist.job_id.
recruiter_id INT(11) No — FK → user(user_id).
ON DELETE
CASCADE — jobs
removed if recruiter
account deleted.
category_id INT(11) Yes NULL FK →
category(category_id)
. ON DELETE SET
NULL — job remains
if category deleted,
category_id becomes
NULL.
title VARCHAR(100) No — Job title displayed in
search results. Max
100 chars. Indexed
for keyword search.
description TEXT No — Full role description.
Must be non-blank.
Rendered as HTML in
the job detail page.
eligibility TEXT Yes NULL Optional
qualifications/skills
requirements. If
NULL, no eligibility
criteria are shown.
salary_min DECIMAL(10,2) Yes NULL Minimum monthly
salary (NPR). NULL
when salary is not
disclosed. Must be ≤
salary_max.
salary_max DECIMAL(10,2) Yes NULL Maximum monthly
salary (NPR).
Validated: salary_max
≥ salary_min when
both provided.
location VARCHAR(100) No — City, district, or the
string 'Remote'. Used
in location filter on the
student search page.
application_deadlin DATE No — Must be a future date
e at creation time.
Applications blocked
after this date by
ApplicationService.
is_active TINYINT(1) No 1 1 = visible and
accepting
applications. 0 =
deactivated by
recruiter or admin.
Checked before
apply.
posted_date TIMESTAMP No NOW() Set at INSERT.
Immutable. Displayed
as 'Posted on' in job
listings.
4.7 Application
4.8 complaint
Attribute Type / Size Null? Default Business
Rule / Notes
complaint_id INT(11) No AUTO_INC Surrogate PK.
user_id INT(11) No — FK →
user(user_id).
ON DELETE
CASCADE.
Any role may
file a
complaint.
subject VARCHAR(200) No — Brief title of the
complaint. Max
200 chars.
Displayed in
admin
complaint list.
message TEXT No — Full complaint
text. Must be
non-blank.
Shown in
admin
complaint
detail view.
status ENUM No PENDING Allowed
values:
PENDING,
RESOLVED,
REJECTED.
Updated only
by admin.
admin_respons TEXT Yes NULL Admin's
e resolution
message. Set
when status
changes to
RESOLVED or
REJECTED.
created_at TIMESTAMP No NOW() Complaint
submission
timestamp.
Immutable.
resolved_at TIMESTAMP Yes NULL Set by system
when admin
saves a
RESOLVED or
REJECTED
response.
4.9 complaint
Attribute Type / Size Null? Default Business Rule / Notes
content_id INT(11) No AUTO_INC Surrogate PK.
page_name VARCHAR(50) No — Unique slug: 'about',
'contact', 'privacy', 'terms'.
Used as URL identifier by
ContentServlet.
title VARCHAR(200) No — Page heading rendered in
the <h1> of the public
page.
body TEXT No — HTML body content.
Admin can include basic
formatting tags.
Rendered unescaped.
last_updated TIMESTAMP No NOW() Auto-updated ON
UPDATE
CURRENT_TIMESTAMP.
Displayed as 'Last
updated' on the public
page.
updated_by INT(11) Yes NULL FK → user(user_id). ON
DELETE SET NULL —
record kept even if admin
account removed.
5. redundancy elimination
Data redundancy is a situation whereby an identical information has been saved in an
excess of locations. This results in three forms of anomalies: update anomalies (data is
changed in one copy and not in another), insertion anomalies (cannot store a fact
without storing another fact), and deletion anomalies (loss of useful data when a row is
deleted). The subsections that follow detail all redundancy in the raw data and how it is
resolved by the schema campus-job-portal.
6. Conclusion
A rigorous, step-by-step normalization process, starting with an unnormalized flat
record, was used to design the campus_job_portal database. The outcome is an eleven
table schema deployed in MySQL InnoDB using utf8mb4 encoding and with all of the
capabilities of the Campus Job Portal System.
Notable design decisions: role and category lookup tables are in 3NF; the
student_profile and recruiter_profile tables are in 2NF; composite UNIQUE constraints
on application and wishlist ensure that no plain-text credential is ever stored.
The design guarantees consistency of data, enables the effective querying of data with
indexed foreign keys and provides a reliable base to all service-layer operations
implemented in JobService, ApplicationService, UserService, DashboardService and
SearchService.