I'll be able to let you know exactly what I did in the morning when im back in the office.
>From memory tho I think I had to call flush on the childsession, even the the >xml documentation says you dont have to. It would be good if Fabio or any of the other nh-devs could give some confirmation on this. Sent from my HTC -----Original Message----- From: deejbee <[email protected]> Sent: 25 May 2010 09:26 To: nhusers <[email protected]> Subject: [nhusers] Re: Unable to save entities mapped as hilo/guid.comb from childsession Luke, it seems I'm experiencing exactly the same issue (child session not flushing as expected). Did you managed to get any further? On Apr 8, 5:58 pm, Luke Smith <[email protected]> wrote: > Ok, looking at the api documentation leads me to think there is > actually a bug. The xml comment says aboutsession.GetSession(..) > > "Starts a newSessionwith the given entity mode in effect. This > secondarySessioninherits the connection, transaction, and other > context information from the primarySession. It doesn't need to be > flushed or closed by the developer" > > Something is funky with this, I shouldn't be needing to call Flush. > Also it works fine without a call to childSession.Flush when the > entity id is mapped with the identity generator. > > On Apr 8, 2:10 pm, "[email protected]" <[email protected]> > wrote: > > > I have similar code that works fine in the post event listener. Try > > calling flush on thechildsession. > > > On Apr 8, 5:03 am, Luke Smith <[email protected]> wrote: > > > > 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 achild > > > > >sessionwhen 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 achildsessionto 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 (varsession= 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 usingsession.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 -- 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. -- 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.
