Hi,
i discovered a strange behavior and would like to know if anybody
could explain it to me.
I create some transient objects (e.g. MyMappedClass myMappedClass =
new MyMappedClass ()) which are not yet persistent in the data base.
In another part of the program I get some persistent objects using the
following code:
IList<T> items = null;
ISession session =
SessionProviderStatic.Instance.GetSession(); // exectueds a
sessionFactory.OpenSession()
ITransaction trans = null;
try
{
trans = session.BeginTransaction();
ICriteria query = session.CreateCriteria(typeof(T));
items = query.List<T>();
trans.Commit();
return items;
}
catch (Exception ex)
{
trans.Rollback();
if (log.IsFatalEnabled) log.Fatal("Error getting
items: " + ex.Message, ex);
throw;
}
finally
{
SessionProviderStatic.Instance.CloseSession();
}
For some reason the transient objects are now saved after this
procedure to the database. I know that a trans.Commit() will cause
Flush (using Flushmode AUto or Commit), but this should not cause a
saving of transient objects, should it?
For this a save/saveOrUpdate/persist should be executed - right. What
could be a possible reason for the behavior?
Thanks antoschka
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---