Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Transitive persistence/cascading in action


In this section, we are going to look at a select few persistence situations to explore the transitive persistence and cascading in detail. We will not be able to explore each and every possible scenario, so we are going to be looking at the following few and understand in detail how these play out under the hood. Understanding these examples should give you enough knowledge to understand any code for any complex scenario:

  • Saving a transient entity with association to one or more other transient entities

  • Updating a persistent entity with one or more associations added/removed

  • Deleting a persistent entity with one or more associations set

Let's get started then.

Saving a transient entity with association to other transient entities

We have seen examples of saving an entity graph involving all transient entities in Chapter 3, Let's Tell NHibernate About Our Database, while discussing association mappings. But let's look at the examples again and understand...