Hi All,
Hibernate version: 3.2.3.ga
Hibernate-Annotations version: 3.3.0.ga
Hibernate-Commons-Annotations version: 3.0.0.ga
I am having a small problem with OneToMany assosiations. Small, because actually they work. But what does not work is the CascadeType.ALL or CascadeType.PERSIST.
I want the owning Object to Persist the Collections Objects when saved.
My Annotation Mapping is this:
PARENT:
Code:
public abstract class AccountGroup extends Account {
@OneToMany(cascade={CascadeType.ALL}, mappedBy="parent")
protected Set<Account> accounts = new HashSet<Account>();
...
}
CHILD:
Code:
public abstract class Account{
...
@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name="parent_account_id")
private Account parent;
...
}
The Actual Accounts are subclasses of this Class. As I Allready wrote. This mapping does work except of the CascadeTypes. I Want to save the Parent and then have the childs being persisted too.
Can anyone give me a hint, why this does not work? From my Point of view hibernate ist simply ignoring what i am telling it to do ;-/
Thx,
Alexander