I'm getting a interesting behavior difference between Set and List. When using Set, the cascade delete works great, i.e. the children are deleted first, then the parent.
but... when using a List, the children are not deleted first, resulting in a constraint violation.
anyone else seen this?
using Hibernate 3.2.6GA, and Annotations 3.3.0GA. Not using Entity Manager.
... using set
@OneToMany(mappedBy="parent",
cascade=CascadeType.REMOVE)
@OrderBy("displayorder")
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
private List<Child> children = new ArrayList<Child>();
... using list
@OneToMany(mappedBy="parent",
cascade=CascadeType.REMOVE)
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
private Set<Child> children = new HashSet<Child>();
|