0% found this document useful (0 votes)
223 views6 pages

Employee Management System Abstract:: Project Design: A. Database Design

1. The document describes a project to create a Java console application to manage employee data stored in an Oracle database. 2. It includes the database design with a table to store employee data and a sequence to generate IDs. 3. The system design outlines Java packages for the DAO, service, bean, and util classes along with their responsibilities. 4. The main EmpMain class will handle user input, validate data, generate IDs, and add employees to the database by calling methods from the DAO class.

Uploaded by

Sandeep Nishad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
223 views6 pages

Employee Management System Abstract:: Project Design: A. Database Design

1. The document describes a project to create a Java console application to manage employee data stored in an Oracle database. 2. It includes the database design with a table to store employee data and a sequence to generate IDs. 3. The system design outlines Java packages for the DAO, service, bean, and util classes along with their responsibilities. 4. The main EmpMain class will handle user input, validate data, generate IDs, and add employees to the database by calling methods from the DAO class.

Uploaded by

Sandeep Nishad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Employee Management System

Abstract:
Create a console based Java application that would allow the HR admin of a company to add /
modify / view information of an Employee as per the design specifications given below. The
data received from the user (HR admin) will be stored in database and retrieved when required.

Project Design:
A. Database Design:
1. Create a new user in database [ To be done in the backend by using sql commands ]
a) Note: Do NOT use the default scott/tiger account of oracle for this project. You will
have to create a new user in the below mentioned format.
b) Username/password : B<batchnumber><employeeid>
For example, if your batch number is 39806 and Employee number is 12345, then
the oracle user should be B3980612345 and the password should beB3980612345
c) For JDBC connection, only use orcl as service name and 1521 as port number

2. Steps for creating a new user


a) Open command prompt
b) Sqlplus / as sysdba
c) Create user <username> identified by <password>; [ For example to create a user
name “test” with password “test” : create user test identified by test; ]
d) Grant connect,resource to <username>; [ E.g: grant connect,resource to test;]
e) Commit;
f) Exit;

3. Create Table [ To be done using sql commands, after logging-in as the new user that
has been created in above step ]

Table Name : EMPLOYEE_TBL

Column Datatype Description


empid Varchar2(6) This field is the Primary Key.
name Varchar2(25)
dob Date sql date
gender Varchar2(7)
salary Number(8,2)

4. Create Sequence:
Sequence Name : EMPID_SEQ

Sequence Minimum Max Incremental Start


Name Value Values value Value
EMPID_SEQ 1000 9999 1 1000

B. System Design:
Name of the package Usage
com.wipro.emp.service This package will contain the class which displays the console menu and
take user input.
com.wipro.emp.bean This package will contain the entity class named EmployeeBean.
com.wipro.emp.dao This package will contain the class that will do the database related
JDBC code.
com.wipro.emp.util This package will contain the class to establish database connection and
also the class that handles the user defined exception.

Package: com.wipro.emp.util

Class Method and Variables Description


DBUtil DB connection class
public static Establish a connection to the
ConnectiongetDBConnection() database and return the
java.sql.Connection reference
InvalidInputException User defined exception class.
Override the toString() method of
the Object class and return a String
“Invalid Data in Input”. This
exception will be thrown in
theaddEmployee(EmployeeBean
empBean) method of the EmpMain
Class if the input to the method is
incorrect. More details are given in
the addEmployee(EmployeeBean
empBean method) of the EmpMain
Class.

Package: com.wipro.emp.bean

Class Method and Variables Description


EmployeeBean Bean class
private String empID 6 Letter ID auto generated
private String empName
private Date dateOfBirth java.util.Date
private String gender
private float salary
setters & getters Should create the getter and setter
methods for all the attributes
mentioned in the class

Package: com.wipro.emp.dao

Class Method and Variables Description


EmployeeDAO DAO class
public This method should take the values
StringcreateEmployee(EmployeeBean from the empBean and insert it into
empBean) the database. If the insertion is
successful, then a String “SUCCESS”
should be returned, else a String
“FAIL” should be returned. If any JDBC
exception such as SQLException
Occur, this function should return
“FAIL”
public EmployeeBeanfindByID(String id) This method should use the JDBC
select statements to retrieve the
record based on the given Employee
ID, Store the fields in the
EmployeeBean and return the
Employee bean. In case of any
JDBCExceptions or if the id does not
exist in the database then a null value
needs to be returned
public int generateNumber () This method should be used to get the
next sequence number from
empid_seq sequence that is created in
oracle.

Package: com.wipro.emp.service

Class Method and Variables Description


EmpMain Main class
public static voidmain(String[] args) The code that is needed to test your program
goes here. A sample code is shown at the end
of the document.
public 1. This method should add an Employee to
StringaddEmployee(EmployeeBean the database.
empBean) 2. If the empBean parameter is null or if the
employee name is null or if the employee
name has less than 2 characters then a
user defined
exceptionInvalidInputException(found
incom.wipro.emp.utilpackage ) should
be thrown.
This exception should be handled within
theaddEmployee(EmployeeBean)function
itself.
If this exception is caught, then the
function is expected to return a String
“Invalid Data in Input”.
NOTE: Do NOT useSystem.exit(0) while
handling the exception.
3. If the empBean object is valid, this
function should call
thegenerateNumber () function of
the EmployeeDAO class to obtain the
next sequence number
4. The employee id has to be formed by
following the below points:
Employee ID is a combination of first 2
letters of
EmpName in uppercasefollowed by 4
digit number that was generated in the
previous step.
5. Once the employee id is formed, use it to
initialize the empBean’s empID and
invoke the createEmployee method of
the EmployeeDAO class to insert the
bean into the database.
On successful storage of the Employee
Details, the function should return a
customized String message as given
below
[ E.g if Employee ID generated is SA1001,
then the success message should
be Employee with ID SA1001 is stored
successfully]
6. If by any reason, the record is not stored,
then the function should return the
String Error in storing the Employee Data
public  This method should retrieve the data from
EmployeeBeanviewEmployeeByID(String the employee table for the EmployeeID
EmployeeID) passed, by following the below steps.
 Invoke the findByID(String id) method of
the EmployeeDAOclass.
 If record is found, the details should be
stored in a EmployeeBean object and
returned.
 If record is NOT found or has INVALID
empID (such as an empty string “”), then
the EmployeeBean should be assigned null
and returned.

Test Cases:
Below are the actual set of test cases that the CPC test engine will run in the
background. Please ensure that the conditions mentioned in these test-cases are
handled by your class design.

Test case 1: Test Null value for Employee Bean.


Test case 2: Test Empty Value for Employee Name
Test case 3: Test Employee name for less than two characters
Test case 4: Test for correct data

Test case 5: Test Employee Details by passing correct Id

Test case 6: Test Employee Details by passing wrong Id


Test case 7: Test Employee Details for empty Id

Main Method:

You can write code in the main method and test all the above test cases. A sample
code of the main function to test the second test case is shown below for your
reference.
public static void main(String[] args) {
EmpMain empmain = new EmpMain();
EmployeeBean empbean = new EmployeeBean();
empbean.setEmpName("");
empbean.setGender("Male");
empbean.setSalary(5000);
empbean.setDateOfBirth(new java.util.Date());
String result = empmain.addEmployee(empbean);
System.out.println(result);
}

You might also like