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

Mapping components


So far we have been using the term entity to refer to classes that NHibernate is able to persist to database. But when it comes to NHibernate, there is more to that term. An entity is something that has its own identifier and can be distinguished from another instance of same type by using the identifier value. An important feature of entity is that NHibernate is able to track the entity. This means that NHibernate knows whether the entity is only present in memory but is not persisted to database, or is persisted to database but the instance in the memory is updated, and so on (sometimes this is also called dirty tracking). Another important feature of entities is that they are saved in their own database table. The way NHibernate handles the entities gives them an identity of their own. This enables the entities to be fetched from database, navigate from one entity to other entity, and so on, using entity identifiers.

Not every class in the domain model needs to be an...