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 3692134
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:13:39+00:00 2026-05-19T04:13:39+00:00

We have a large management application and we do a lot of logging for

  • 0

We have a large management application and we do a lot of logging for every action, for instance, who did what and at what time.

However we have more and more automatic systems which we would like to differentiate as well.

In all of our tables we have a column called PerformedBy which is an int. This has always been a reference to a Table called Employees which then have a corresponding Name.

However we would now like to have some system users (for instance online payment server, online booking and so on).
We could of cause create these in the employees table however that seems incorrect and we wouldn’t be certain of IDs (this is a commercial system, so we have 200 databases which would have to be updated.)

So what I would really like to do is make a mapping so that if an ID is positive it maps to an employee which is loaded from the database. However, if it is negative I would like to have some static classes which derive from Employee one for each type of system user.

Something like:

class OnlineBooking : Employee
{
}

Is something like this possible with NHibernate or does someone have another great solution ?
I would like not to add additional columns to ALL the tables that have logs.

  • 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-19T04:13:39+00:00Added an answer on May 19, 2026 at 4:13 am

    One column / two meanings is a classic database smell. You definitely want to split this into two columns.

    You will not be able to enable foreign key constraints with the positive / negative approach that you describe.

    http://www.agiledata.org/essays/databaseRefactoringSmells.html

    This will also greatly simplify mapping. Adding a column may seem like a lot of extra work, but it is worth it in the long run.

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

Sidebar

Related Questions

In my application I have large area (≈5000x5000pts) and I must allow user to
My application problem is the following - I have a large structure foo. Because
I have an application that stores large amount of files (XML and binary) in
I have an application that sometimes will utilize a large amount of data. The
I have an application which predictably generates out-of-memory errors on very, very (very) large
We have a large management software that is producing big reports of all kinds,
OK, so I have a very large multi-threaded unmanaged c++ application (server) that runs
We have a client who is currently using Lotus Notes/Domino as their content management
I have large images displayed in a grouped tableview. I would like the images
I have large database table, approximately 5GB, now I wan to getCurrentSnapshot of Database

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.