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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:28:52+00:00 2026-05-13T07:28:52+00:00

I’ve spent the better part of my day trying to solve this message while

  • 0

I’ve spent the better part of my day trying to solve this message while using NHibernate: “Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index”

My update and delete work just fine but the call to flush after a call to save() does not work. I don’t think it will be useful to post all of the code (there’s a lot) because I’m not sure what you’ll need to see at this point. My data access object I’m trying to save uses a composite key if that helps. Also, I’m using NHibernate.Mapping.Attributes to create my mapping.

It appears that in my stack trace NHibernate is attempting to send an invalid number of parameters to the ADO.Net class for the insert operation. That being said, I have trace set to true in order to view sql statements but the error is raised prior to the sql statement being sent to the output so I’m not sure what it’s attempting to build..

public void Insert(ProddataDAO Entity)
{
        Entity.PSEQ = GetNewSeqID(Entity.PCUST); // <- because I'm using a composite key, this function gets my a unique value by a group
        NHibernateHelperCGC.CurrentSession.Save(Entity);            
        NHibernateHelperCGC.CurrentSession.Flush();   // <-This raises the error         
}

at System.Collections.ArrayList.get_Item(Int32 index) at
IBM.Data.DB2.iSeries.iDB2ParameterCollection.System.Collections.IList.get_Item(Int32
index) at NHibernate.Type.DecimalType.Set(IDbCommand st, Object
value, Int32 index) at
NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value,
Int32 index) at NHibernate.Type.NullableType.NullSafeSet(IDbCommand
st, Object value, Int32 index, ISessionImplementor session) at
NHibernate.Type.ComponentType.NullSafeSet(IDbCommand st, Object value,
Int32 begin, ISessionImplementor session) at
NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object
id, Object[] fields, Object rowId, Boolean[] includeProperty,
Boolean[][] includeColumns, Int32 table, IDbCommand statement,
ISessionImplementor session, Int32 index) at
NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id,
Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql,
Object obj, ISessionImplementor session) at
NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id,
Object[] fields, Object obj, ISessionImplementor session) at
NHibernate.Action.EntityInsertAction.Execute() at
NHibernate.Engine.ActionQueue.Execute(IExecutable executable) at
NHibernate.Engine.ActionQueue.ExecuteActions(IList list) at
NHibernate.Engine.ActionQueue.ExecuteActions() at
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource
session) at
NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent
event) at NHibernate.Impl.SessionImpl.Flush() at
WTS.Data.DB2.CGC.ProddataRepository.Insert(ProddataDAO Entity) in
C:\Documents and Settings\briant\My Documents\Visual Studio
2008\Projects\WTSCGCDAL\WTSCGCDAL\ProddataRepository.cs:line 73 at
WTS.WTSCGCAppInterface.ProductionDataUserControlBase.TestInsert() in
C:\Documents and Settings\briant\My Documents\Visual Studio
2008\Projects\WTSCGCAppInterface\WTSCGCAppInterface\ProductionDataUserControlBase.cs:line
483 at WTSCGCAppInterface.Window1.Button_Click_1(Object sender,
RoutedEventArgs e) in C:\Documents and Settings\briant\My
Documents\Visual Studio
2008\Projects\WTSCGCAppInterface\WTSCGCAppInterface\Window1.xaml.cs:line
48 at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object
target, RoutedEventArgs routedEventArgs) at
System.Windows.EventRoute.InvokeHandlersImpl(Object source,
RoutedEventArgs args, Boolean reRaised) at
System.Windows.UIElement.RaiseEventImpl(DependencyObject sender,
RoutedEventArgs args) at
System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at
System.Windows.Controls.Primitives.ButtonBase.OnClick() at
System.Windows.Controls.Button.OnClick() at
System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs
e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object
sender, MouseButtonEventArgs e) at
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate
genericHandler, Object genericTarget) at
System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object
target) at
System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target,
RoutedEventArgs routedEventArgs) at
System.Windows.EventRoute.InvokeHandlersImpl(Object source,
RoutedEventArgs args, Boolean reRaised) at
System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender,
RoutedEventArgs args, RoutedEvent newEvent) at
System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject
sender, MouseButtonEventArgs e) at
System.Windows.UIElement.OnMouseUpThunk(Object sender,
MouseButtonEventArgs e) at
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate
genericHandler, Object genericTarget) at
System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object
target) at
System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target,
RoutedEventArgs routedEventArgs) at
System.Windows.EventRoute.InvokeHandlersImpl(Object source,
RoutedEventArgs args, Boolean reRaised) at
System.Windows.UIElement.RaiseEventImpl(DependencyObject sender,
RoutedEventArgs args) at
System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean
trusted) at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs
input) at
System.Windows.Input.InputProviderSite.ReportInput(InputReport
inputReport) at
System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd,
InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x,
Int32 y, Int32 wheel) at
System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr
hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at
System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd,
Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at
MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam,
IntPtr lParam, Boolean& handled) at
MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Boolean isSingleParameter) at
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,
Delegate callback, Object args, Boolean isSingleParameter, Delegate
catchHandler) at
System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback,
Object args, Boolean isSingleParameter, Delegate catchHandler) at
System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority
priority, TimeSpan timeout, Delegate method, Object args, Boolean
isSingleParameter) at
System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority
priority, Delegate method, Object arg) at
MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr
wParam, IntPtr lParam) at
MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at
System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame
frame) at
System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run() at
System.Windows.Application.RunDispatcher(Object ignore) at
System.Windows.Application.RunInternal(Window window) at
System.Windows.Application.Run(Window window) at
System.Windows.Application.Run() at WTSCGCAppInterface.App.Main()
in C:\Documents and Settings\briant\My Documents\Visual Studio
2008\Projects\WTSCGCAppInterface\WTSCGCAppInterface\obj\Debug\App.g.cs:line
0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
args) at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()

  • 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-13T07:28:53+00:00Added an answer on May 13, 2026 at 7:28 am

    This error usually appears when there are columns missing from your tables. So if a class has a property mapped to table column that is missing from the database then you will see this error.

    Basically check for mismatches between your mappings and your database tables (missing columns, type mismatches etc). The problem may be on a related table/entity and not on the one you are trying to save.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

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.