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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:54:07+00:00 2026-05-14T04:54:07+00:00

Given a database that has numerous repeating columns used for auditing and versioning, what

  • 0

Given a database that has numerous repeating columns used for auditing and versioning, what is the best way to model it using NHibernate, without having to repeat each of the columns in each of the classes in the domain model?

Every table in the database repeats these same nine columns, the names and types are identical and I don’t want to replicate it in the domain model.

I have read the docs and I saw the section on inheritance mapping but I couldn’t see how to make it work in this scenario. This seems like a common scenario because nearly every database I’ve work on has had the four common audit columns (CreatedBy, CreateDate, UpdatedBy, UpdateDate) in nearly every table. This database is no different except that it introduces another five columns which are common to every table.

  • 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-14T04:54:08+00:00Added an answer on May 14, 2026 at 4:54 am

    This can be accomplished by using the component element in the mapping file.

    The basic idea is to create a class to hold the common properties and reference it from each of the entities in your model.

    Then inside your mapping file add a reference to this property like this…

    <component name="RecordMetadata" class="RecordMetadata" insert="true" update="true">
        <property name="UpdatedBy" />
        <property name="UpdatedDate" />
        <property name="CreatedBy" />
        <property name="CreatedDate" />
    </component>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database that has three columns Maker, Model and Price and I
I have a MySQL database that has several databases used by more than 1
I'm working with a database that has a lot of linked model objects and
Given a model that has validations in the model_name.rb file, how can I access
Given a Database that has a table Called [Bid Transactions], which contains records of
I Have to get a movie from a PostgreSQL database that matches a given
Is there a way to query a MySQL database that gives me all blobs
The Database Engine Tuning Advisor has finally given up the ghost and can't help
Given a database that contains three fields: Latitude Longitude Proximity Where Lat and Long
I have a database that logs when an employee has attended a course and

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.