Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Regarding database design

Posted on 2014-03-29
Medium Priority
Last Modified: 2014-10-24

I am writing the code in struts2 with spring security by assigning the roles and permissions. I am trying to accomplish the following:

There is a status of the employee as bench or blocked. Blocked means the employee is alloted for a project but not yet assigned. An employee (by default in bench state) can be blocked by Project manager. Blocking indicates that employee is alloted for a particular project and if not assigned into the project in two weeks he will be released, indicates that the employee is in bench again.

An blocked employee can be made assigned if he selected into the project. Assigned is the subset of block.

Clicking a link called assign, the status of the employee (default is bench) should change from bench to assigned. (assigned is a status given to an employee).
Clicking a link called block, the status of the employee (default is bench) should change from bench to blocked. (blocked is also status of the employee).
Clicking a link called release, the status of the employee should change from assigned to release.
A resource can be blocked which means they can be assigned a project but not yet be assigned. A blocked resource that has not assigned for two weeks needs to be released automatically, how can I do that?

How should I structure the database for this? Also, how do I declare the pojo classes for this type of design?

Blocked means he is into project but not yet confirmed, assigned means he is into the project and confirmed as billing.

How to design the pojo classes and database design for this type of situation ?

I  just want the table structure and pojo classes so that i can develop the coding

thanks in advance
Question by:narayana252
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
LVL 80

Expert Comment

ID: 39964415
I think you are mixing the design/architecture of the database and the business process within the application.

An employee has four states of being: available/benched, blocked, assigned, released
However, in reality available, benched, released means the employees can be selected into an existing or a new project, correct.

The two week period means you have to have a blocked table through which you have a scheduled job that will review whether there is a record whose expiry time is older than now() in this case, the emoloyeedId is used to change the employee status from blocked, to benched/available.

You then would have an assigned table where you can have, the project, the employee, and the assigned date.
If a possibility exists that an employee can be in the project for a specific set of tasks and upon their completion, can be released, would need a separate transactional assigned table, that will have similar table as the relationship one from before, but would include a unassigned/complete date that will maintain the records for employee assignment to a project and when the project concluded or the employee was released.

Unfamiliar with the strut2 and pojo to address.

Author Comment

ID: 39964539
Hi Arnold, the solution given by you is 50% understandable to me. I am not understanding the table struture for it . But your analyzation is right. Bench and release are going to the same state as bench.
LVL 80

Accepted Solution

arnold earned 2000 total points
ID: 39964547
Wouldn't available be the same as well?

employee table.
blocked relationship table between a projects table and the employee table. with the expiration date
ProjectID, employeeID,Expiration date (entries here are deleted when expired or when the user is assigned/released)
1, 3,2014-04-10

Then you have an active transactional and relationship table depending on whether there is a possibility that a user might be assigned to the project for a portion of a time versus for the duration of the project.  The distinction deals with accounting for individuals that worked on the project  for a period shorter than the duration of the project.

active relationship table (when the user is deactivated or the project is done, entries here are deleted make sure to delete these entries after updating the transactional table.)
projectID,employeeID, Date Activated

Active transactional table
projectID, employeeID, date activated,date released(project completed)

You could use view to join employee and the blocked/assigned tables with conditional check to identify whether the user is available/released/benched (does not have an entry in either of the other tables, or blocked with expiration date, or assigned with start date)

The use of a view deals with whether performing the query on the fly is frequent enough and uses up more resources than the auto-updating view.
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  


Author Comment

ID: 39965842
Hi Arnold, thanks for the solution. What i have understood from your solution is that employee table, blocked table, projects table are there. can you please give me the table strutcuture clearly with the fields and relationships ?

A project manager can also block/assign an employee. Blocked means he will be there blocked for two weeks. Assigned means he is into project and the duration is not specified here.


LVL 80

Expert Comment

ID: 39965848
I outlined the minimal structure based on the information you provided.

Author Comment

ID: 39974125
Hi Arnold, the solution was really very nice and clearly explained. I was just looking the ORM kind of relation w.r.t pojo classes and tables. I am using hibernate for this application. I need to get the pojo classes for this and relation to the corresponding table.

The solution given by arnold is very good but i am dilema in writing java pojo classes and setting the relation between them.

thanks & regards,

LVL 80

Expert Comment

ID: 39974170
Do you have an example of a pojo class and a table relationship that you already have working.  I can look at those and see if I can reverse engineer it such that I might be able to provide guidance for the pojo class with the database design discussed here.

Another option, if you do not already have the mysql workbench, you should get it from http://dev.mysql.com/downloads/tools/
I think there is also toad for mysql http://www.quest.com/toad-for-mysql/

The workbench can be used to create the database design.

Author Comment

ID: 39974189
Hi Arnold, i am working on the pojo classes.

In this one i have developed one pojo class for employee. In that a property called projectStatus is kept. ProjectStatus is another pojo class with three pojo classes as instance viriables in it as bench, block, assign.

class Empoloyee{
private String empId;
private ProjectStatus projectStatus;
private Project projectId;

class ProjectStatus{

private Bench bench;
private Block block;
private Assign assign;

When Resource manager creates a employee profile the default state of the employee is bench. How to acheive this using java (servlets or struts2) ?

What should be the relation between employee and project status.

Any bench employee can be blocked by an Resource manager, blocking indicates the state changes from bench to block and block state is for two weeks. What ever the pojo classes i have created are right or wrong ? please guide me

thanks & regards

LVL 80

Expert Comment

ID: 39975475
IMHO, you should first define the data structure and the business process.
Once you have that, defining pojo classes might become simpler,  you seem to be caught between defining the pojo classes and the database structure.  When both are changeable, it complicates things.  When you have the data/business process defined  you could adjust the data structure if needed during the definition of the pojo classes one at a time.

Author Comment

ID: 39979978
You are right arnold

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question