Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • hansdesmedt 10 posts 31 karma points
    Apr 15, 2013 @ 10:32
    hansdesmedt
    0

    IndexOutOfRangeException, could not execute query, NHibernate

     

    Hi,

    We use UCommerce 2.6 with umbraco 4.7.2.  We get a lof of these errors in our elmah:

    • System.IndexOutOfRangeException: OrderId155_
    • System.IndexOutOfRangeException: Category1_95_0_
    • System.IndexOutOfRangeException: ProductC1_142_
    • ...

    They start randomly, and we need to recycle the site to get him up again.

    I guess this is an error in NHibernate framework?  I found here a possible solution:

    http://stackoverflow.com/questions/1667413/nhibernate-system-indexoutofrangeexception

    Did somebody else get this error?  Anyone knows how to solve this?  

    We use a lot of synchronisers so we only will upgrade to UC 3.5 if this will solve this problem. Will upgrade to UC 3.5 help?

    All info is welcome.

    Here more info about the errors:

    could not initialize a collection batch: [UCommerce.EntitiesV2.Category.CategoryDescriptions#System.Object[]][SQL: SELECT categoryde0_.CategoryId as CategoryId1_, categoryde0_.CategoryDescriptionId as Category1_1_, categoryde0_.CategoryDescriptionId as Category1_95_0_, categoryde0_.CategoryId as CategoryId95_0_, categoryde0_.CultureCode as CultureC3_95_0_, categoryde0_.DisplayName as DisplayN4_95_0_, categoryde0_.Description as Descript5_95_0_ FROM uCommerce_CategoryDescription categoryde0_ WHERE categoryde0_.CategoryId=?]
      at NHibernate.Loader.Loader.LoadCollectionBatch(ISessionImplementor session, Object[] ids, IType type)
      at NHibernate.Loader.Collection.BatchingCollectionInitializer.Initialize(Object id, ISessionImplementor session)
      at NHibernate.Persister.Collection.AbstractCollectionPersister.Initialize(Object key, ISessionImplementor session)
      at NHibernate.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection(InitializeCollectionEvent event)
      at NHibernate.Impl.SessionImpl.InitializeCollection(IPersistentCollection collection, Boolean writing)
      at NHibernate.Collection.AbstractPersistentCollection.Initialize(Boolean writing)
      at NHibernate.Collection.Generic.PersistentGenericSet`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
      at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
      at UCommerce.EntitiesV2.Category.GetDescription(String cultureCode)
      at ASP._Page_macroScripts_PageTitle_cshtml.Execute() in \\arfyes.com\websharedcontent\webfarm01\club.mylene.eu\macroScripts\PageTitle.cshtml:line 21
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
      at umbraco.macro.loadMacroScript(MacroModel macro)
      at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
      at umbraco.presentation.templateControls.Macro.CreateChildControls()
      at System.Web.UI.Control.EnsureChildControls()
      at umbraco.presentation.templateControls.Macro.OnInit(EventArgs e)
      at System.Web.UI.Control.InitRecursive(Control namingContainer)
      at System.Web.UI.Control.InitRecursive(Control namingContainer)
      at System.Web.UI.Control.InitRecursive(Control namingContainer)
      at System.Web.UI.Control.InitRecursive(Control namingContainer)
      at System.Web.UI.Control.InitRecursive(Control namingContainer)
      at System.Web.UI.Control.InitRecursive(Control namingContainer)
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

    Error adding macro Menu
    could not execute query
    [ select TOP (@p0) productcat0_.ProductCatalogId as ProductC1_142_, productcat0_.Name as Name142_, productcat0_.Deleted as Deleted142_, productcat0_.ProductCatalogGroupId as ProductC4_142_, productcat0_.PriceGroupId as PriceGro5_142_, productcat0_.CreatedBy as CreatedBy142_, productcat0_.CreatedOn as CreatedOn142_, productcat0_.DisplayOnWebSite as DisplayO8_142_, productcat0_.ModifiedBy as ModifiedBy142_, productcat0_.ModifiedOn as ModifiedOn142_, productcat0_.ShowPricesIncludingVAT as ShowPri11_142_ from uCommerce_ProductCatalog productcat0_ where productcat0_.Name=@p1 ]
     Name:p1 - Value:Webshop
    [SQL: select TOP (@p0) productcat0_.ProductCatalogId as ProductC1_142_, productcat0_.Name as Name142_, productcat0_.Deleted as Deleted142_, productcat0_.ProductCatalogGroupId as ProductC4_142_, productcat0_.PriceGroupId as PriceGro5_142_, productcat0_.CreatedBy as CreatedBy142_, productcat0_.CreatedOn as CreatedOn142_, productcat0_.DisplayOnWebSite as DisplayO8_142_, productcat0_.ModifiedBy as ModifiedBy142_, productcat0_.ModifiedOn as ModifiedOn142_, productcat0_.ShowPricesIncludingVAT as ShowPri11_142_ from uCommerce_ProductCatalog productcat0_ where productcat0_.Name=@p1]
      at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
      at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
      at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
      at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
      at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
      at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
      at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
      at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
      at NHibernate.Impl.ExpressionQueryImpl.List()
      at NHibernate.Linq.NhQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
      at NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression expression)
      at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
      at UCommerce.EntitiesV2.ProductCatalog.FirstOrDefault(Expression`1 expression)
      at ASP._Page_macroScripts_Navigation_cshtml.Execute() in \\arfyes.com\websharedcontent\webfarm01\club.mylene.eu\macroScripts\Navigation.cshtml:line 14
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer)
      at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer)
      at System.Web.WebPages.WebPageBase.Write(HelperResult result)
      at ASP._Page_macroScripts_Menu_cshtml.Execute() in \\arfyes.com\websharedcontent\webfarm01\club.mylene.eu\macroScripts\Menu.cshtml:line 30
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
      at umbraco.macro.loadMacroScript(MacroModel macro)
      at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
      at umbraco.presentation.templateControls.Macro.CreateChildControls()

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 15, 2013 @ 11:07
    Søren Spelling Lund
    0

    Which specific version of uCommerce 2.6.?.? are you using?

    Could you send me the queries you're executing?

  • hansdesmedt 10 posts 31 karma points
    Apr 15, 2013 @ 12:55
    hansdesmedt
    0

    uCommerce 2.6.1.0

     

    We do not execute specific queries, we just use the ucommerce entities for that:

     

    Some examples:

     

    var category = Category.Get(categoryId);

     

    [IndexOutOfRangeException: Name96_0_]

       System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName) +5043306

       System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) +67

       NHibernate.Driver.NHybridDataReader.GetOrdinal(String name) +13

       NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) +47

       NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) +30

       NHibernate.Type.AbstractType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner) +19

       NHibernate.Persister.Entity.AbstractEntityPersister.Hydrate(IDataReader rs, Object id, Object obj, ILoadable rootLoadable, String[][] suffixedPropertyColumns, Boolean allProperties, ISessionImplementor session) +852

       NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, String instanceClass, EntityKey key, String rowIdAlias, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session) +275

       NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, String rowIdAlias, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session) +138

       NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session) +290

       NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) +159

       NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +675

       NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +129

       NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister) +252

     

    [GenericADOException: could not load an entity: [UCommerce.EntitiesV2.Category#6574][SQL: SELECT category0_.CategoryId as CategoryId96_0_, category0_.Name as Name96_0_, category0_.DisplayOnSite as DisplayO3_96_0_, category0_.CreatedOn as CreatedOn96_0_, category0_.CreatedBy as CreatedBy96_0_, category0_.ModifiedBy as ModifiedBy96_0_, category0_.ModifiedOn as ModifiedOn96_0_, category0_.Deleted as Deleted96_0_, category0_.SortOrder as SortOrder96_0_, category0_.ParentCategoryId as ParentC10_96_0_, category0_.ProductCatalogId as Product11_96_0_, category0_.DefinitionId as Definit12_96_0_, category0_.ImageMediaId as ImageMe13_96_0_ FROM uCommerce_Category category0_ WHERE category0_.CategoryId=?]]

     

    2.

     

    var catalog = ProductCatalog.FirstOrDefault(c => c.Name == EshopCatalogs.WEBSHOP);

     

     

    [IndexOutOfRangeException: ProductC1_142_]

       System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName) +5043306

       System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) +67

       NHibernate.Driver.NHybridDataReader.GetOrdinal(String name) +13

       NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) +47

       NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) +30

       NHibernate.Loader.Loader.GetKeyFromResultSet(Int32 i, IEntityPersister persister, Object id, IDataReader rs, ISessionImplementor session) +93

       NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) +92

       NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +675

       NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +129

       NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +140

     

    [GenericADOException: could not execute query

    [ select TOP (@p0) productcat0_.ProductCatalogId as ProductC1_142_, productcat0_.Name as Name142_, productcat0_.Deleted as Deleted142_, productcat0_.ProductCatalogGroupId as ProductC4_142_, productcat0_.PriceGroupId as PriceGro5_142_, productcat0_.CreatedBy as CreatedBy142_, productcat0_.CreatedOn as CreatedOn142_, productcat0_.DisplayOnWebSite as DisplayO8_142_, productcat0_.ModifiedBy as ModifiedBy142_, productcat0_.ModifiedOn as ModifiedOn142_, productcat0_.ShowPricesIncludingVAT as ShowPri11_142_ from uCommerce_ProductCatalog productcat0_ where productcat0_.Name=@p1 ]

      Name:p1 - Value:Webshop

     

    We Use

    •  .NET framework 4.0
    • SQL Server 2008 R2

    Connection string before: "server=xxx;database=xxx;Integrated Security=True;"

     

    I just added: Pooling=False to all the connection strings in the web.config.  I think this will help because all errors fail on GetOrdinal() method of NHibernate.  And I found on stackoverflow this can solve the error.

    Connection string after: "server=xxx;database=xxx;Integrated Security=True;Pooling=false"


  • Søren Spelling Lund 1797 posts 2786 karma points
    May 24, 2013 @ 09:40
    Søren Spelling Lund
    0

    The latest version of uCommerce (3.6) includes updated versions of NHibernate. That might help as well.

Please Sign in or register to post replies

Write your reply to:

Draft