|
After migrating from Hibernate 3.6 to 4.2, I had a change in behavior that may not be correct. I think it is related to the fix of
HHH-5124
.
In a process, I use an EntityManager for two transactions. In the first transaction, I create two beans, A and B, A having a reference to B. I commit the first transaction. In the second transaction, I remove B. Transaction commit ends without errors, but B is not removed.
What I expected was: failure to commit.
Based on JPA 2 specification, I would understand this behavior if everything had be done in the same transaction.
If the two transactions are done in separated EntityManagers, the commit of the second transaction fails (as I expected) because of the violated SQL foreign key constraint.
|