Hy,
I have problems to save (update) a data object which is loaded through HQL. Is it not possible to update a object in the same session?
I used the following code (for testing):
Code:
...
NHibernate.ISessionFactory f = config.BuildSessionFactory();
NHibernate.ISession s = f.OpenSession();
NHibernate.IQuery q = s.CreateQuery("from DoUser");
q.SetMaxResults(1);
DoUser user = (DoUser)q.UniqueResult();
user.LastOnlineDate = DateTime.Now;
s.SaveOrUpdate(user);
...
The log file says:12:47:50.868 [3400] DEBUG NHibernate.Impl.SessionImpl - Update() object already associated with session
Source-Code SessionImpl.cs
Code:
if( IsEntryFor( theObj ) ) // == true, because the object is already loaded!?
{
log.Debug( "object already associated with session" );
// do nothing
}
Hibernate version: 1.0.2