What is cascading and what are different types of cascading?



What is cascading and what are different types of cascading?..

Answer / Satish Kumar Ranjan

Cascading in Hibernate refers to the propagation of certain operations, such as save, update, delete, or refresh, from one entity instance to related entities. There are five different types of cascading in Hibernate:

1. Cascade.ALL: Cascades all lifecycle operations (save, update, delete, and refresh) from the parent entity to the child entities.
2. Cascade.PERSIST: Cascades only the save operation from the parent entity to the child entities.
3. Cascade.MERGE: Cascades only the merge operation from the parent entity to the child entities.
4. Cascade.REMOVE: Cascades only the delete operation from the parent entity to the child entities.
5. Cascade.REFRESH: Cascades only the refresh operation from the parent entity to the child entities.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What is the difference between level 1 and level 2 cache?

1 Answers  


What is @manytoone fetch fetchtype lazy?

1 Answers  


What is the purpose of hibernate?

1 Answers  


What is cascade and inverse in hibernate?

1 Answers  


How does lazy loading work in hibernate?

1 Answers  


Define cascade and inverse option in one-many mapping?

1 Answers  


How many layers are there in hibernate architecture?

1 Answers  


Which type of associated entities are eagerly loaded by default?

1 Answers  


What is hibernate and why it is used?

1 Answers  


What is the default annotation for a property in hibernate?

1 Answers  


What are the types of inheritance models in hibernate?

1 Answers  


Why are callback interfaces useful in hibernate?

1 Answers  


Categories