Regarding database design

Posted on 2014-03-29
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 78

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 78

Accepted Solution

arnold earned 500 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.
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.


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 78

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 78

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
I think there is also 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 78

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

740 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