I have an MVC app using NHibernate.
I created a model and tried to insert data into the db for the first time with NHibernate, so please go easy.
I get this error on the session.Save(object);
IndexOutOfRangeException was unhandled by user code
Invalid index 8 for this SqlParameterCollection with Count=8.
When I look at the data in the object using watch window all seems ok and also collections are inittialized.
Using SQL 2005.
Any ideas why this may be occurring please?
Malcolm
I have had the same problem using NHibernate myself, the problem in my case was in the mapping. On my associations I have mapped a property containing the associated entity, and also a property with the association ID only.
The solution in my case was to add update="false" insert="false"
to my mapping of the property containing the ID.
Like this:
<property name="AssociationId" column="AssociationColumnName" update="false" insert="false" />
<many-to-one name="Association" column="AssociationColumnName" property-ref="Id" not-null="false" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With