Is deleting an entity with children/foreign keys/CascadeType.REMOVE atomic? Do I need a transaction or I can omit it?
Is deleting an entity with children/foreign keys/ CascadeType.REMOVE atomic? Do I need a transaction
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You always need a transaction, it is not optional. There is no atomicity guarantee ever outside a transaction. Theoretically, if you gave the details of the exact database implementation and version number, it may turn out that in that special case the update is indeed atomic, but the fact would remain that this is no way to write reliable software.
You can read over here on Hibernate’s attitude towards transactions.