休眠级联 [英] Nhibernate Cascade

查看:35
本文介绍了休眠级联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CascadeNhibernate 是什么意思?

我在级联中看到了很多选项:

I see a lot of options in cascading:

  • 删除
  • 全部
  • AllDeleteOrphan
  • 删除孤儿
  • 保存更新

你能用例子和它们的区别来解释这些吗?

Can you explain these with with examples and their distinctions?

推荐答案

表示将操作应用于项目的相关项目.

It means apply the action to an item's related items.

请看:NHibernate Cascades:all-delete的区别-孤儿和保存更新:

  • none - 不做任何级联,让用户自行处理.

  • none - do not do any cascades, let users handle them by themselves.

save-update - 当对象是保存/更新,检查关联并保存/更新任何对象需要它(包括保存/更新多对多关联设想).

save-update - when the object is saved/updated, check the associations and save/update any object that requires it (including save/update the associations in many-to-many scenario).

delete - 当对象被删除,删除所有对象该协会.

delete - when the object is deleted, delete all the objects in the association.

删除孤儿——当对象被删除时,删除所有关联中的对象.在另外,当一个物体从协会中删除,而不是与另一个对象相关联(孤儿),也删除它.

delete-orphan - when the object is deleted, delete all the objects in the association. In addition, when an object is removed from the association and not associated with another object (orphaned), also delete it.

all - 当一个对象被保存/更新/删除时,检查关联和保存/更新/删除所有找到的对象.

all - when an object is save/update/delete, check the associations and save/update/delete all the objects found.

all-delete-orphan - 当一个对象被删除时保存/更新/删除,检查关联和保存/更新/删除找到的所有对象.在除此之外,当一个对象被移除时来自协会而不是与另一个对象(孤立的),也删除它.

all-delete-orphan - when an object is save/update/delete, check the associations and save/update/delete all the objects found. In additional to that, when an object is removed from the association and not associated with another object (orphaned), also delete it.

这篇关于休眠级联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆