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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:05:06+00:00 2026-05-12T18:05:06+00:00

As the question states, is it possible to map a composite key in fluent

  • 0

As the question states, is it possible to map a composite key in fluent nhibernate (or non fluent i suppose) where one of the two fields used in the composite is an identity field?

I have a table where one part of the primary key is an identity field and the other is a tenant id. This is a legacy database where the composite key is used as foreign keys all over, so modifying the database would be quite significant.

thanks!

  • 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-12T18:05:06+00:00Added an answer on May 12, 2026 at 6:05 pm

    If it’s really an identity column, then it’s guaranteed to be unique for every record, right?

    If so, you can ignore the tenancy ID completely for mapping purposes. Your identity fields will be unique in your primary table – AND your foreign key references will contain this unique Id, so the tenancy ID is actually irrelevant.

    NHibernate doesn’t really care whether you’re mapping your database schema exactly. I’ve worked with legacy databases before where I’ve defined a unique constraint on a non-key column and then told NHibernate to use that as the primary key – it works, and it can neatly sidestep all kinds of horrific composite-key relationship mappings.

    Think about it. Counter-intuitive, but it will probably work.

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

Sidebar

Related Questions

The current top-voted to this question states: Another one that's not so much a
My question is simply: is it even possible? Suppose I want to style a
As the question states - is there a good tool out there which lists
As the question states, i am a C#/Java programmer who is interested in (re)learning
I would (as the question states) like to make an asynchronous call, preferably using
In @mmalc's response to this question he states that In general you should not
On this question , there's an answer that states: You can use typedef to
I'm taking the GRE tomorrow, and had a question. Based on the answer key,
An answer to a Stack Overflow question stated that a particular framework violated a
Question as stated in the title.

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.