TipsOnLips.net

Your .net tips and tricks source

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010


NHibernate Error: System.IndexOutOfRangeException: Invalid index 5 for this SqlParameterCollection with Count=5..

When getting this error, one possible cause is to check your .hbm file for more than one property referencing same database column name, as below:

The MobilePhone property referencing (copy and paste problem) the same column name as the Phone property above it as in Fig (1):

                                                                                               Fig (1)

While when correcting the MobilePhone column name to 'MobilePhone' as in Fig (2), you code should work properly.

 

 

That's it, hope that helps. Thanks.


Categories: NHibernate
Posted by developer on Friday, May 29, 2009 6:44 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Unexpected row count: 0; expected: 1, NHibernate

Error: NHibernate.StaleStateException: NHibernate.StaleStateException: Unexpected row count: 0; expected: 1.

Usually when you get this error, may be check the session.Insert or session.InsertOrUpdate methods, as if a domain object which being saved had an assigned identifier, then InsertOrUpdate would throw this error.


Categories: NHibernate
Posted by developer on Friday, November 28, 2008 9:49 AM
Permalink | Comments (0) | Post RSSRSS comment feed

NHibernate Inverse="true" Definition

It means non-owner of the relationship whose table doesn't have the foreign key. Similarly, the Hibernate inverse="false" attribute is equivalent to the ... owner of the relationship whose table has the foreign key.

Source:

http://bchavez.bitarmory.com/archive/2007/10/06/nhibernate-and-inversetruefalse-attribute.aspx


Tags: ,
Categories: NHibernate
Posted by developer on Thursday, July 17, 2008 6:54 AM
Permalink | Comments (0) | Post RSSRSS comment feed