save-update with Cascade

Let’s perform Save-Update operations with and without cascade to understand it better save-update with Cascade Annotation configuration Applicant.java @OneToMany(mappedBy="applicant")   @Cascade(CascadeType.SAVE_UPDATE)       private Set<Address> addresses; @OneToMany(mappedBy=”applicant”) @Cascade(CascadeType.SAVE_UPDATE) private Set<Address> addresses; XML configuration applicant.hbm.xml <set name="addresses" table="Address"                 inverse="true" lazy="true" fetch="select" cascade="save-update">           […]

Share this article on

Delete with Cascade

Let’s perform Delete operation with and without cascade to understand it better Delete with Cascade Annotation configuration Applicant.java @OneToMany(mappedBy="applicant")   @Cascade(CascadeType.DELETE)       private Set<Address> addresses; @OneToMany(mappedBy=”applicant”) @Cascade(CascadeType.DELETE) private Set<Address> addresses; XML configuration applicant.hbm.xml <set name="addresses" table="Address"                 inverse="true" lazy="true" fetch="select" cascade="delete">           […]

Share this article on
< Previous Next >