I played with pre event listeners, but my understanding is the post
event listeners are the place to perform auditing, I could be wrong.

However talking about event listeners is getting side tracked from the
issue im raising, which is reproducible outside of event listeners.

On Apr 7, 6:03 pm, Jason Meckley <[email protected]> wrote:
> have you tried using a pre event listener instead of post? since you
> are using client ids the id is part of the event listener's arguments
> (not sure exactly where though).
>
> On Apr 7, 12:20 pm,LukeSmith<[email protected]> wrote:
>
>
>
> > I don't see that as being the same topic apart from us both performing
> > auditing, my auditing logic code is working (though using a post event
> > listener and logging all property changes).
>
> > The problem i'm having is to do with saving a new entity to a child
> > session when the entity identiy is mapped with either hilo or
> > guid.comb (I don't want to use identity as then I cannot bulk insert
> > the audit log entries). The entity does not get commited to the
> > database. The code in my original post replicates the issue outside of
> > event listeners, and is nothing to do with auditing.
>
> > On Apr 7, 4:57 pm, Jason Meckley <[email protected]> wrote:
>
> > > same topic discussed 
> > > here:http://groups.google.com/group/nhusers/browse_thread/thread/a12a591be...
>
> > > On Apr 7, 11:36 am,LukeSmith<[email protected]> wrote:
>
> > > > Excuse the bump.
>
> > > > If this is a bug then I'll raise it in the Jira.
>
> > > > Any pointers?
>
> > > > Thanks
>
> > > > On Feb 24, 1:33 pm,LukeSmith<[email protected]> wrote:
>
> > > > > 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?- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

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