Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 985707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:12:19+00:00 2026-05-16T05:12:19+00:00

I am currently working on a project which has Employee, Manager entities. At the

  • 0

I am currently working on a project which has Employee, Manager entities. At the very beginning, I took for granted that a manager must be an employee in the company, so they are the same person who have the same EmployeeID in payroll system. Based on this assumption, I let the Manager class extends Employee class.

Later, my client told me that sometimes some managers are not an employee in the company, but they still have employees report to them and these managers should also be in the system. The inheritance relationship between employee and manager is broken and now I have two independent classes with two tables (TAB_EMPLOYEE & TAB_MANAGER) in the database.

Both manager and employee can access to the system with an username and password. There is a class named User and the system should provide functions to create user account for managers and employees. In the previous situation, manager extends employee, I can create an user account for a manager and assign two roles (ROLE_EMPLOYEE, ROLE_MANAGER) to the user. But now, if an user account has already been created for an employee (this employee is also a manager, so besides a record in TAB_EMPLOYEE, there is a record in TAB_MANAGER), how can I create an user account for him as a manager? I know I can just assigned a ROLE_MANAGER to the existing user (so that the user has two roles: ROLE_EMPLOYEE, ROLE_MANAGER), but after the user logged in, I have to use the username or userid to load the referenced objects (Employee and/or Manager). In order to do this, I have to options:

Option 1: Add a userid column in both TAB_EMPLOYEE and TAB_MANAGER tables.
Option 2: Add two columns ObjectType, ObjectId in TAB_USER, ObjectType contains EMPLOYEE or MANAGER, and ObjectId contains the related id.

I am not sure which option is better or is there any other options to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:12:19+00:00Added an answer on May 16, 2026 at 5:12 am

    I would combine the tables so there is simply a staff table. Then I would add a unary relationship (pointer back to itself) to identify the manager. Lastly I would add a flag to identify internal staff (employees).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a project which contains a window, that has a
I'm currently working on a project that has a very interesting set of requirements.
I currently working on a project which uses Spree Cart and which has hence
I am currently working on a project that is very new to me, and
I am currently working on a project which has a tab control which contains
I am currently working on a MYSQL project which has a few fairly standard
I am currently working on a project which has to use WebSockets as a
I'm currently working on a Padrino project which has been working absolutely fine in
Currently I am working on a project which has following setup. AVR micro-controller IDE
I am currently working on a very big project which involves many-to-many and one-to-many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.