因此,我有一个名为“秩序”的母体, 以及一个叫做“秩序”的子体的集合, 叫做“线粒子”的子体, 与卡丝卡德一起, 设置在新赫伯纳的全世无主的孤儿身上。这是我的代码。
using( var session = _sessionManager.GetSession())
using (var transaction = session.BeginTransaction())
{
var order = _repository.GetOrderEagerlyByOrderId(session, fromDb.Id);
var now = DateTime.Now;
const string user = "GNB\Username";
var future = now.AddYears(1);
var taxType = new TaxType(0, "Code", "AlternateNameE", "AlternateNameF", "NameE", "NameF", "DescriptionE", "DescriptionF", 13, now, future, user, now, user, now);
var _serviceCatRep = new ServiceCatalogueRepository();
var serviceCatalogueItem = _serviceCatRep.GetServiceCatalogueItemByCode(session, "VR-PASS");
var orderLineItem1 = new OrderLineItem(0, null, "DescriptionE", "DescriptionF", 1, 10, null, null, 5, false, serviceCatalogueItem, null, user, now, user, future);
order.OrderLineItems.Clear();
order.OrderLineItems = order.OrderLineItems == null ? new List<IOrderLineItem> { orderLineItem1 } : new List<IOrderLineItem>(order.OrderLineItems) { orderLineItem1 };
_repository.SaveOrUpdate(session, order);
transaction.Commit();
}
在 transaction.communit ();
上失败,错误如下:
Nhembernate.HebertateException: 一家拥有级联的收藏 = “全电子孤儿” 不再被拥有实体实例所引用。
举个例子说,所有孤儿和所有孤儿之间有什么区别。