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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:40:47+00:00 2026-05-28T19:40:47+00:00

I have db tables in each I have same primary column name (‘ID’) I

  • 0

I have db tables in each I have same primary column name (‘ID’)

I get error from nhibernate:

System.IndexOutOfRangeException : An SqlCeParameter with
ParameterIndex '5' is not contained by this SqlCeParameterCollection

When I change these columns names to unique names, all is ok.

But i wonder how to fix it without name changes. I simply want same name in each table.

 <class name="AppSignature" table="app_signatures" lazy="true">
    <id name="Id"><generator class="guid"></generator></id>

  </class>

  <class name="AppState" table="app_states" lazy="true">
    <id name="Id"><generator class="guid"></generator></id>

    <many-to-one name="app_signature" 
                 class="AppSignature"                 
                 column="Id"
                 foreign-key="id_fom_app_signature"
                 not-null="true"                 
                 >         
    </many-to-one>

  </class>
  • 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-28T19:40:48+00:00Added an answer on May 28, 2026 at 7:40 pm

    Many-to-one relation means that an AppState instance can be assigned at most to one AppSignature instance. To an AppSignature can be assigned any number of AppState instances. This relation is implemented as an foreign key from app_states table to app_signatures table. “Column” attribute in “many-to-one” element determines column name that stores a value for the foreign key. To the Id column are mapped two AppState members: Id and app_signature which is not possible in NH and leads to the described exception.
    The fix is easy:

    <many-to-one name="app_signature" 
                 class="AppSignature"                 
                 column="app_signature_id"
                 foreign-key="id_fom_app_signature"
                 not-null="true"                 
                 >         
    </many-to-one>
    

    Name of column that implements foreign key was changed to an unique name: “app_signature_id”. Now app_signature member is mapped to AppState.app_signature_id column which points to the app_signatures.Id column

    However described exception should disappear (if the new column is properly added to app_signatures table) it would not necessarily be what you you really want. The relation between AppState and AppSignature could be one-to-one. It means an AppState instnace can be assigned to a single AppSignature instnance and vice versa. Such relation could be implemented by a primary and foreign key on the same column. There is a very nice article about one-to-one relations.

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

Sidebar

Related Questions

I have a MySQL database with multiple tables, each of which have the same
Hi I want to have two tables each have an INT id column which
i have two tables products and reviews each product has several reviews linked by
I have two tables in a DataSet where the ID field on each is
I have an existing database with tables which each have 4 partitions (there are
Possible Duplicate: Retrieving the last record in each group I have two tables set
A common (i assume?) type of query: I have two tables ('products', 'productsales'). Each
I have created script to find selectivity of each columns for every tables. In
I have a mysql db with 10 tables. Each table drives a website where
I have a website laid out in tables. (a long mortgage form) in each

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.