session « Cascade « JPA Q&A





1. Hibernate - Setting a cascade persist just for one session    stackoverflow.com

I have this relation in Hibernate:

    n      1
A   ------->   B
The cascade types in the @OneToMany from A to B ...

2. after cascade no need session.save()    forum.hibernate.org

I still do not understand the why after cascade=all, we do not have to call the save()? Can anyone explain to me? The explicit call to save() is still annoying. We will address this by using cascades. This simplifies the code above to Parent p = (Parent) session.load(Parent.class, pid); Child c = ...