Hi,
What does the term persistence mean when dealing with nHibernate?
What exactly is persistent?
Hi,
What does the term persistence mean when dealing with nHibernate?
What exactly is persistent?
It means that an entity is associated with the database and changes will be written or 'persisted' to the database.
This is opposed to a transient object that only exists in memory.
Persistence is when something is saved long-term, so a crash or power-loss won't affect it
The term persistence usually means that data is stored in a durable way, that it is still available after the program is terminated or the computer is turned off. When using a database for persistence, data is made persistent by writing it to the database and committing it.
Persistent is also a term in Nhibernate that refers to one of the instance states. It means that the object is synchronized by NH with the database. NH takes care that all the changes on a persistent object get stored to the database. The changes also need to be committed before they are actually persistent (durable).
Persistence is storing the state of existing data so that it can be retrieved and reused at a later time. Without it you wouldn't be able to reconstitute your objects between uses of your software.
Most ORMs (of which NHibernate is one) expose SQL schemas/databases as objects. When you modify those objects, you need to "persist" those changes back to the database and this is commonly referred to as data persistence.
In context of Data operations, Persisting is saving or updating the data back to the Database.
In terms of the Objectes, Persisted state means the iobject is synchronised with the DB.
We normally use the ISEssion >> SaveOrUpdate(object) method to persist the values.