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

  • Home
  • SEARCH
  • 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 3280564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:43:07+00:00 2026-05-17T19:43:07+00:00

I am stuck with a legacy database involving composite keys and there is no

  • 0

I am stuck with a legacy database involving composite keys and there is no room to modify the db.

The problem seems to be that one part of the key is also used for each foreign key.
So if I have tables A and B like this:

A

  • company (PK)
  • aId (PK)
  • someMoreInfo

B

  • company (PK, FK)
  • bId (PK)
  • aId (FK)
  • someOtherInfo

The company field in table B is PK for table B and used for ther FK to table A. All the things I tried lead me to Repeated column in mapping exceptions.

So this is not a ‘how do I’ question (well, if you have a solution – go ahead I’d consider myself lucky if this is just my imagination and there is no real problem…) but a ‘do you feel this is right’ question.

  • could it be possible to acces a db like this using nhibernate (well, apart from mapping all tables 1:1 without references)
  • do you feel it is a good idea?
  • what are the alternatives given my circumstances (i.e. Are any O/R-Mappers good at this)?

BTW: This is the same problem, and one of my complex scenarios is here.

  • 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-17T19:43:08+00:00Added an answer on May 17, 2026 at 7:43 pm

    I don’t know how to solve the particular foreign-key-overlaps-primary-key issue you have, but I will say of the ORMs I’ve tried, NH is the most likely to be compatible with your legacy schema; in fact, it’s one of NH’s biggest design goals. So I’d say NH is right, and you’re more likely to find an answer in it than you are with most other ORMs.

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

Sidebar

Related Questions

Being stuck with a legacy database schema that no longer reflects your data model
I'm migrating data from a legacy database that has many tables with primary keys
So, my problem is this. I have a legacy MySQL database that I'm building
I'm hoping someone can help me with mapping a legacy database. The problem I'm
We are stuck with a database that (unfortunately) uses floats instead of decimal values.
I'm stuck on a fix to a legacy Visual C++ 6 app. In the
I'm trying to read a legacy JSON code using Jackson 2.0-RC3, however I'm stuck
I stuck with problem of mail application , i am developing a website for
Im stuck with this little project in C# but basically my problem is this:
im stuck with a problem im basically trying to create a function where I

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.