That method is called in... well...what you are looking for, probably, is the override of DefaultSaveEventListener, DefaultSaveOrUpdateEventListener
2009/3/18 epitka <[email protected]> > > Thanks, > Reason I was asking is because I cannot get the interceptor to be > called. I registered it with a session > like this > > return SessionFactory.OpenSession(new IsTransientInterceptor()); > > and repository calls SaveOrUpdate on the session. > But the interceptor does not get called. I know I have dirty items in > a collection and I can see in trying to update. What else do I need to > do to get a call to interceptor? > > Here is intereceptor imlementation > > public class IsTransientInterceptor : > global::NHibernate.EmptyInterceptor > { > public void SetSession(ISession session) > { > base.SetSession(session); > } > > public bool OnLoad(object entity, object id, object[] state, > string[] propertyNames, IType[] types) > { > base.OnLoad(entity, id, state, propertyNames, types); > if (entity is IIsTransient) ((IIsTransient)entity).OnLoad > (); > return false; > } > > public bool OnSave(object entity, object id, object[] state, > string[] propertyNames, IType[] types) > { > base.OnSave(entity, id, state, propertyNames, types); > if (entity is IIsTransient) ((IIsTransient)entity).OnSave > (); > return false; > } > > public bool? IsTransient(object entity) > { > base.IsTransient(entity); > if (entity is IIsTransient) > { > return ((IIsTransient)entity).IsTransient; > } > > return false; > } > } > > here is the log > > 2009-03-18 11:03:05,494 [Task: Test Runner] DEBUG > NHibernate.AdoNet.ConnectionManager [(null)] - registering flush begin > 2009-03-18 11:03:05,494 [Task: Test Runner] DEBUG > NHibernate.Persister.Collection.ICollectionPersister [(null)] - > Deleting rows of collection: > [SR.Domain.Client.Entities.Client.AccountTypeHistory#921115600] > 2009-03-18 11:03:05,494 [Task: Test Runner] DEBUG > NHibernate.Persister.Collection.ICollectionPersister [(null)] - no > rows to delete > 2009-03-18 11:03:05,510 [Task: Test Runner] DEBUG > NHibernate.Persister.Collection.ICollectionPersister [(null)] - > Updating rows of collection: > SR.Domain.Client.Entities.Client.AccountTypeHistory#921115600 > 2009-03-18 11:03:05,510 [Task: Test Runner] DEBUG > NHibernate.Persister.Collection.ICollectionPersister [(null)] - done > updating rows: 0 updated > 2009-03-18 11:03:05,510 [Task: Test Runner] DEBUG > NHibernate.Persister.Collection.ICollectionPersister [(null)] - > Inserting rows of collection: > [SR.Domain.Client.Entities.Client.AccountTypeHistory#921115600] > 2009-03-18 11:03:05,510 [Task: Test Runner] DEBUG > NHibernate.AdoNet.AbstractBatcher [(null)] - Opened new IDbCommand, > open IDbCommands: 1 > 2009-03-18 11:03:05,510 [Task: Test Runner] DEBUG > NHibernate.AdoNet.AbstractBatcher [(null)] - Building an IDbCommand > object for the SqlString: UPDATE PRDPROD.dbo.ClientAcctType SET > ClientId = ?, EffDt = ? WHERE ClientId = ? AND EffDt = ? > 2009-03-18 11:03:05,526 [Task: Test Runner] DEBUG > NHibernate.Engine.IdentifierValue [(null)] - unsaved-value strategy > NONE > 2009-03-18 11:03:05,526 [Task: Test Runner] DEBUG > NHibernate.Transaction.AdoTransaction [(null)] - Enlist Command > 2009-03-18 11:03:05,557 [Task: Test Runner] DEBUG > NHibernate.AdoNet.AbstractBatcher [(null)] - Closed IDbCommand, open > IDbCommands: 0 > 2009-03-18 11:03:05,604 [Task: Test Runner] ERROR > NHibernate.Event.Default.AbstractFlushingEventListener [(null)] - > Could not synchronize database state with session > NHibernate.StaleStateException: Unexpected row count: 0; expected: 1 > > > On Mar 18, 11:02 am, Fabio Maulo <[email protected]> wrote: > > No > > > > 2009/3/18 epitka <[email protected]> > > > > > > > > > Hi, Is there a way to use IsTransient from event listeners rather then > > > implementing interceptors. > > > > -- > > Fabio Maulo > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
