Improve company productivity with a Business Account.Sign Up


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
  • 5
  • 5
LVL 82

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 82

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.
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.


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 82

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 82

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 82

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

606 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