Hi!
Here is your code:
Code:
Item item = ItemDao.FindByID(item.ID);
item.XmpieDocument.XmpieFields = GetXmpieFields();
ItemDao.SaveOrUpdateCopy(item);
It seems that you already have the item or parts of the item loaded and you are using this object reference to reload the entity:
Item item = ItemDao.FindByID(item.ID);
You have extracted all the XmpieFields from the previous item state and possibly modified at least on or added more fields to the collection which you set back on the item's XmpieDocument:
item.XmpieDocument.XmpieFields = GetXmpieFields();
Thus, when you call SaveOrUpdate, then there might be persistent objects that is already attached to the current running session in the object graph and these must be evicted from the session to avoid this exception [by calling session.Evict(...)].
Based on the exception, I would say it's an instance of this class that must be evicted from the session: MyCompany.DataAccessLayer.BulkOrder.XmpieFields.
HTH,
Steinar.