---
title: "hibernate-cascade属性介绍"
author: "wanglihu"
date: "2012-02-17T10:47:10Z"
tags: []
categories: ["开源软件"]
slug: "hibernate-cascade"
draft: false
lastmod: "2012-02-17T10:47:10Z"
id: 1409260
url: "https://wanglihu.iteye.com/blog/1409260"
---

1.none:在保持，更新或删除当前对象时，忽略其他关联的对象。它是cascade属性的默认值。

2.save-update：当通过session的save()、update()、saveOrUpdate()方法来保持或更新当前数据时，级联保存所有关联的新建的临时对象，并且级联更新所有关联的游离对象。

3.delete：当通过session的delete()方法删除当前对象时，级联删除所有关联的对象。

4.all：包含save-update以及delete的行为。此外，对当前对象执行evict()或lock()操作时，也会对所有关联的持久化对象执行evict()或lock()方法。

5.delete-orphan：删除所有和当前对象解除关联关系的对象。

6.all-delete-orphan：包含all和delete-orphan的行为。