c# - NHibernate: identifier of an instance of object was altered from x to y -
i have situation nhibernate. have piece of code:
private void unlinkproductsfrompriceagreement(namevaluecollection collection, iunitofwork unitofwork) { // price agreement id int priceagreementid = collection.getint("id"); foreach (int productid in collection.getids("unlinkproductslist")) { // product price iproductprice productprice = productpricerepository.find(p => p.priceagreement.id == priceagreementid && p.product.productid == productid).firstordefault(); // remove product price productpricerepository.delete(productprice); } }
i exception when run code:
qe.common.core.exceptions.persistencyexception ---> nhibernate.hibernateexception: identifier of instance of qe.vending.core.domainobjects.product altered 210036 0 @ nhibernate.event.default.defaultflushentityeventlistener.checkid(object obj, ientitypersister persister, object id, entitymode entitymode) in d:\csharp\nh\nh\nhibernate\src\nhibernate\event\default\defaultflushentityeventlistener.cs:line 111 @ nhibernate.event.default.defaultflushentityeventlistener.getvalues(object entity, entityentry entry, entitymode entitymode, boolean mightbedirty, isessionimplementor session) in d:\csharp\nh\nh\nhibernate\src\nhibernate\event\default\defaultflushentityeventlistener.cs:line 84
how possible?
Comments
Post a Comment