[hibernate-dev] Hibernate 4.0.1: regression with @OneToMany(cascade = CascadeType.REMOVE)
Guillaume Smet
guillaume.smet at gmail.com
Wed Jan 18 11:17:12 EST 2012
Hi,
In our test cases, we have a test which checks a lot of cascade
configuration (it's more to document all the cascade behaviors than to
really test an application).
After the upgrade from Hibernate 4.0 to Hibernate 4.0.1, we have a test failing:
- a person is linked to a company
- if we delete a company, it should cascade to the persons due to the
annotation @OneToMany(cascade = CascadeType.REMOVE)
Company {
@OneToMany(cascade = CascadeType.REMOVE)
@JoinTable(name="company_employees4",
joinColumns=@JoinColumn(name="company_id"),
inverseJoinColumns=@JoinColumn(name="employees4_id"))
private List<Person> employees4 = new LinkedList<Person>();
}
In the case of a person linked to 2 companies
- we have an exception with Hibernate 4.0: this is what we expect as
the person is linked to another company and the database warns us
about it thanks to the foreign key;
- the delete is OK with 4.0.1 (no exception due to the foreign key)
and if I try to get the person after that, it's still there so it
seems as if the cascade is not triggered at all.
Does it ring a bell to anyone? I don't have a lot of time atm to
extract a self contained test case so if it's something obvious due to
4.0 -> 4.0.1 fixes, I might pass on this one. I checked the release
notes without finding something which can explain this new behavior.
If it's not something obvious, I'll try to work on a test case in the
next few days. If so, pointers to where I should add the test in the
code base are greatly appreciated.
Thanks for your feedback.
Thanks.
--
Guillaume
More information about the hibernate-dev
mailing list