怎么不能级联删除

我的实体是这样配置的,如何实现删除树一个节点的时候子节点自动删除呢?是否可以像下面的一样采用级联删除呢?我试过用这种方式删除不了,不知道该怎么样删除,求高手解答
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="t_tree")
public class Tree {
private String id;
private String name;
private Set<Tree> children = new HashSet<Tree>();
private Tree parent;

@Id
@Column(name="id",length=32)
@GeneratedValue(generator = "uid")  
    @GenericGenerator( strategy = "uuid", name = "uid") 
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(cascade=CascadeType.ALL, mappedBy="parent")
public Set<Tree> getChildren() {
return children;
}
public void setChildren(Set<Tree> children) {
this.children = children;
}

@ManyToOne
@JoinColumn(name="parent_id")
public Tree getParent() {
return parent;
}
public void setParent(Tree parent) {
this.parent = parent;
}

}

你可能感兴趣的:(删除)