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 for support.

  • Henrik Stokbro 15 posts 65 karma points
    Jul 01, 2015 @ 13:37
    Henrik Stokbro

    Error when I change order status

    I want to change status on my order.

    My code

    var newOrderStatus = OrderStatus.All().Single(x => x.Name == statusName);
    var orderService = ObjectFactory.Instance.Resolve<IOrderService>();
    orderService.ChangeOrderStatus(order, newOrderStatus);

    newOrderStatus, order & orderService look fine. What am I doing wrong?

    I get this error:

    NHibernate.PropertyValueException was unhandled by user code
      Message=not-null property references a null or transient value UCommerce.EntitiesV2.OrderStatusAudit.NewOrderStatus
           at NHibernate.Engine.Nullability.CheckNullability(Object[] values, IEntityPersister persister, Boolean isUpdate)
           at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
           at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
           at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
           at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)
           at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
           at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)
           at NHibernate.Impl.SessionImpl.SaveOrUpdate(String entityName, Object obj)
           at NHibernate.Engine.Cascade.CascadeToOne(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)
           at NHibernate.Engine.Cascade.CascadeCollectionElements(Object parent, Object child, CollectionType collectionType, CascadeStyle style, IType elemType, Object anything, Boolean isCascadeDeleteEnabled)
           at NHibernate.Engine.Cascade.CascadeCollection(Object parent, Object child, CascadeStyle style, Object anything, CollectionType type)
           at NHibernate.Engine.Cascade.CascadeOn(IEntityPersister persister, Object parent, Object anything)
           at NHibernate.Event.Default.AbstractFlushingEventListener.CascadeOnFlush(IEventSource session, IEntityPersister persister, Object key, Object anything)
           at NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(IEventSource session)
           at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)
           at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
           at NHibernate.Impl.SessionImpl.Flush()
           at UCommerce.Transactions.OrderService.ChangeOrderStatus(PurchaseOrder purchaseOrder, OrderStatus newOrderStatus, String userName)
           at Weheart.Print.ChangeOrderStatus(PurchaseOrder order, String statusName) in c:\bastard\Bastard\weheart\Print.cs:line 247
           at Weheart.Print.SendOrders() in c:\bastard\Bastard\weheart\Print.cs:line 107
           at Bastard.Handler.ProcessRequest(HttpContext context) in c:\bastard\Bastard\Testing.ashx.cs:line 20
           at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
           at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
  • Martin 181 posts 740 karma points
    Jul 01, 2015 @ 17:17

    Hi Henrik,

    Which version of uCommerce are you running? Looking by the stack trace it seems that a property has a null-value on the OrderStatusAudit.

    If you know which version you're running I can perhaps investigate it a bit further.

    Best regards Martin

  • Henrik Stokbro 15 posts 65 karma points
    Jul 01, 2015 @ 18:00
    Henrik Stokbro

    My version: uCommerce

  • Martin 181 posts 740 karma points
    Jul 02, 2015 @ 18:27

    Hi again Henrik,

    The new orderstatus you're trying to change to, is that a custom order status or an uCommerce built-in orderstatus?

    Best regards Martin

  • Henrik Stokbro 15 posts 65 karma points
    Jul 22, 2015 @ 08:50
    Henrik Stokbro

    It seems that changeOrderStatus makes a save. (I think)

    So the error did not come from changeOrderStatus it self, but from when changeOrderStatus saves.

    The error was in an audit I added before calling changeOrderStatus.

Please Sign in or register to post replies

Write your reply to: