Invalid Index N For This SqlParameterCollection using NHibernate

While trying to insert parent child composite key linked into a database I received this error:

  • Ungültiger Index N für SqlParameterCollection mit Count=8
  • Invalid Index N For This SqlParameterCollection with count=8

When I added the:

insert="false"

attribute to the 8th property in my mapping file, the issue was resolved. Start with the ID at 0 and then count down the file.

The problem was that in line 1 I had the same column name identified as I had in line 8. I needed the value in both places because line 1 was a property and line 8 was the:

<many-to-one />

relationship. Adding the:

insert="false"

attribute to the to the:

<many-to-one />

resulted in being able to save the parent child relationship.