InterviewSolution
Saved Bookmarks
| 1. |
What is the dirty checking feature of Hibernate? Explain? |
|
Answer» Cascading means when an INSERT, update or delete operation occurs on one ENTITY, its related entities also are inserted, updated or deleted. If cascading is not used, the objects will have to be saved independently and explicitly. import org.hibernate.annotations.Cascade; @Entity @Table(name = "EMPLOYEE") public class Employee { @OneToOne(mappedBy = "employee") @Cascade(value = org.hibernate.annotations.CascadeType.ALL) public Department dept; }The CascadeTypeenum constants of Hibernate are slightly different from JPA. As shown in the above example, we use. CascadeType and Cascade annotations for mappings. The commonly used cascading types as DEFINED in CascadeTypeenum are:
|
|