We are using Spring/hibernate with OnetoMany/ManytoOne relationships. We are using HQL save methods to persist to database. Lets say, if there is a one to one/one to many/many to one relationships, we are persisting an object with reference to child objects. Does this approach help in ensuring transaction management that if persisting to child table fails, will it automatically rollback the parent table as well?
We are using Spring/hibernate with OnetoMany/ManytoOne relationships. We are using HQL save methods to
Share
You should use
@Transactionalannotation which is available in Spring to achieve this.This link clearly explains about the usage of transaction in spring.
http://static.springsource.org/spring/docs/2.0.x/reference/transaction.html