Hi

Hopefully this is something I'm doing wrong. My case is im saving
auditlogs in a PostInsertEventListener, im using the following to
create a child session to save the audit log entries.

var childSession = @event.Session.GetSession(EntityMode.Poco);

foreach (var entry in entries)
{
childSession.Save(entry);
}

Originally my entities (AuditLogEntry) had an ID mapped with the
identity generator which works fine. When I change this to use either
hilo or guid.comb then none of the AuditLogEntry are flushed to the
database.

I've replicated this outside of EventListeners using the following

using (var session = CreateSession())
            {
                using (var tx = session.BeginTransaction())
                {
                    var person = new Person();

                    // session.Save(person);
                    var childSession =
session.GetSession(EntityMode.Poco);
                    childSession.Save(person);

                    tx.Commit();
                }
            }

<class name="Person" table="Person">
    <id name="Id" column="Id">
      <generator class="hilo"></generator>
    </id>
  </class>

When using session.Save(person) it works (generates the identity and
commits to the database), but when using childSession.Save(person) it
doesn't.

When set to hilo NHProf shows that the next_hi value is read/update
from the database.

Am I missing something or is this a bug?

-- 
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.

Reply via email to