Fluent nHibernate: No row with the given identifier exists.
I have an Object, that has a Items collection. My problem is: Error occurs when 2 users are seeing the object and one user delete some item. The other user should see the object updated, without the deleted item, and not a Exception.
I tried:
session.Evict(p);
// the following line will throw an exception
session.Refresh(p);
No row with the given identifier exists[Sistema.ERPxx.Pedidos.ItemPedido#74435]
In the mapping it is specified:
this.HasMany<ItemPedido>(v => v.Items).KeyColumn("numero_pedido").Cascade.All().OrderBy("descricao_produto").LazyLoad().NotFound.Ignore();
I am with this problem and does not know how to refresh the Item to get the updates that the other user did.
How to Refresh an object with Items without getting an Exception?
it's actually a GOOD thing that you're getting this exception. this is what is called optimistic concurrency (google it; here is a simple enough explanation).
what you need to do is to catch that exception, and translate it into some user-understandable format. for example: