flush - NHibernate FlushMode: How do I set up NHibernate for automatically updating an entity -


After retrieving an entity, I change one of its properties.

I can retrieve the same entity.

How can I tell that Nibbernets, this unit will update the unit before loading?

Code here:

  employee repository employee repository = new employee repository (); Employee employee = employee repository.getbid (4); Employee .ListName = "test !!!"; Employee Employee 2 = Employee Repository. GETIID (4);  

Currently Nhibernate does not create an update in my program. I thought the unit would be updated automatically by simply setting the flushmode to auto.

Edit The background is that I try to redirect this behavior to another application. No method left! Just the code NHibernate version is really old, this version is 1.2.1.4000. Maybe hold on.

An update statement is not generated when I set up a flashmode in the Brownfield application.

But in my own project I still can not reproduce this "automated" behavior.

What are the two calls for the employee Repository is finally the same NHibernate ISession Using the example? If so, they will return the same object, and the updated LastName value will be reflected. If not, then you will need to make sure that you are settling your eSession example each time to take advantage of auto flushing.


Comments