I was looking to use the NHibernate.Events for the LoadEventListener.
I think I have it configured but nothing is getting called.  The one I
am interested in is PreAssignedIdOnLoadListener which inherits from
DefaultLoadEventListener.

Here is my configuation (from a testsetup)
  Configuration cfg = new Configuration();
            cfg.Properties["connection.provider"] =
"NHibernate.Connection.DriverConnectionProvider";
            cfg.Properties["dialect"] =
"NHibernate.Dialect.MsSql2005Dialect";
            cfg.Properties["connection.driver_class"] =
"NHibernate.Driver.SqlClientDriver";
            cfg.Properties["connection.connection_string"] =
db.ConnectionString;
            cfg.Properties["current_session_context_class"] =
"thread_static";
            cfg.EventListeners.LoadEventListeners =
                    new ILoadEventListener[] { new
PreAssignedIdOnLoadListener() };

            cfg.EventListeners.SaveEventListeners =
                new ISaveOrUpdateEventListener[] { new
CustomSaveListener() };

            cfg.AddFile(@"..\..\NHibernate\NTestRow.Hbm.xml");
            _sessionFactory = cfg.BuildSessionFactory();


In my test, I have an Add, one record, Query to verify that the one
record is there.  This is working. I am just not getting calls to the
LoadEventListener (At this point it is a stub, but I have an override
for every overridable method with a breakpoint, but it never gets
there.

Here is the log, if that is helpful. ANY help is much appreciated.

Thanks,
jeff

NHibernate.Cfg.Environment: INFO  - NHibernate 2.0.1.4000 (2.0.1.4000)
NHibernate.Cfg.Environment: INFO  - hibernate-configuration section
not found in application configuration file
NHibernate.Cfg.Environment: INFO  - Bytecode provider name : lcg
NHibernate.Cfg.Environment: INFO  - Using reflection optimizer
NHibernate.Cfg.Configuration: INFO  - Mapping file: ..\..\NHibernate
\NTestRow.Hbm.xml
NHibernate.Dialect.Dialect: INFO  - Using dialect:
NHibernate.Dialect.MsSql2005Dialect
NHibernate.Cfg.XmlHbmBinding.Binder: INFO  - Mapping class:
Crestron.Tools.Core.UnitTests.NHibernate.NTestRow ->
NHibernateTestTable
NHibernate.Cfg.XmlHbmBinding.Binder: DEBUG - Mapped property: Id ->
Id, type: String
NHibernate.Cfg.XmlHbmBinding.Binder: DEBUG - Mapped property: Name ->
Name, type: String
NHibernate.Cfg.Configuration: INFO  - checking mappings queue
NHibernate.Cfg.Configuration: INFO  - processing one-to-many
association mappings
NHibernate.Cfg.Configuration: INFO  - processing one-to-one
association property references
NHibernate.Cfg.Configuration: INFO  - processing foreign key
constraints
NHibernate.Dialect.Dialect: INFO  - Using dialect:
NHibernate.Dialect.MsSql2005Dialect
NHibernate.Exceptions.SQLExceptionConverterFactory: INFO  - Using
dialect defined converter
NHibernate.Connection.ConnectionProviderFactory: INFO  - Initializing
connection provider: NHibernate.Connection.DriverConnectionProvider
NHibernate.Connection.ConnectionProvider: INFO  - Configuring
ConnectionProvider
NHibernate.Cfg.SettingsFactory: INFO  - Transaction factory:
NHibernate.Transaction.AdoNetTransactionFactory
NHibernate.Cfg.SettingsFactory: INFO  - Optimize cache for minimal
puts: False
NHibernate.Cfg.SettingsFactory: INFO  - Connection release mode: auto
NHibernate.Cfg.SettingsFactory: INFO  - Default batch fetch size: 1
NHibernate.Cfg.SettingsFactory: INFO  - Statistics: disabled
NHibernate.Cfg.SettingsFactory: INFO  - Query translator:
NHibernate.Hql.Classic.ClassicQueryTranslatorFactory
NHibernate.Cfg.SettingsFactory: INFO  - Query language substitutions:
{}
NHibernate.Cfg.SettingsFactory: INFO  - cache provider:
NHibernate.Cache.NoCacheProvider, NHibernate, Version=2.0.1.4000,
Culture=neutral, PublicKeyToken=aa95f207798dfdb4
NHibernate.Cfg.SettingsFactory: DEBUG - Wrap result sets: disabled
NHibernate.Cfg.SettingsFactory: INFO  - Batcher factory:
NHibernate.AdoNet.NonBatchingBatcherFactory, NHibernate,
Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
NHibernate.Cfg.SettingsFactory: INFO  - Named query checking : enabled
NHibernate.Impl.SessionFactoryImpl: INFO  - building session factory
NHibernate.Impl.SessionFactoryImpl: DEBUG - instantiating session
factory with properties: {use_reflection_optimizer=True,
connection.provider=NHibernate.Connection.DriverConnectionProvider,
dialect=NHibernate.Dialect.MsSql2005Dialect,
connection.driver_class=NHibernate.Driver.SqlClientDriver,
connection.connection_string=Data Source=SqlBox1;Initial
Catalog=ScratchDeviceLibrary;uid=DLDBO;pwd=Password2,
current_session_context_class=thread_static}
NHibernate.Tuple.Entity.AbstractEntityTuplizer: DEBUG - No custom
accessors found for entity:
Crestron.Tools.Core.UnitTests.NHibernate.NTestRow
NHibernate.Tuple.Entity.AbstractEntityTuplizer: DEBUG - No custom
accessors found for entity:
Crestron.Tools.Core.UnitTests.NHibernate.NTestRow
NHibernate.Impl.SessionFactoryObjectFactory: DEBUG - initializing
class SessionFactoryObjectFactory
NHibernate.Impl.SessionFactoryObjectFactory: DEBUG - registered:
f602f54d761e4dbea2287b89f2d2dfbd(unnamed)
NHibernate.Impl.SessionFactoryObjectFactory: INFO  - no name
configured
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG - Static
SQL for entity: Crestron.Tools.Core.UnitTests.NHibernate.NTestRow
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG -  Version
select: SELECT Id FROM NHibernateTestTable WHERE Id = ?
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG -  Snapshot
select: SELECT ntestrow_.Id, ntestrow_.Name as Name0_ FROM
NHibernateTestTable ntestrow_ WHERE ntestrow_.Id=?
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG -  Insert
0: NHibernate.SqlCommand.SqlCommandInfo
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG -  Update
0: NHibernate.SqlCommand.SqlCommandInfo
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG -  Delete
0: NHibernate.SqlCommand.SqlCommandInfo
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ WHERE ntestrow0_.Id=?
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ WHERE ntestrow0_.Id=?
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ with (updlock, rowlock) WHERE
ntestrow0_.Id=?
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ with (updlock, rowlock) WHERE
ntestrow0_.Id=?
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ with (updlock, rowlock) WHERE
ntestrow0_.Id=?
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for action NHibernate.Engine.CascadingAction+MergeCascadingAction on
entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ WHERE ntestrow0_.Id=?
NHibernate.Loader.Entity.AbstractEntityLoader: DEBUG - Static select
for action NHibernate.Engine.CascadingAction+RefreshCascadingAction on
entity Crestron.Tools.Core.UnitTests.NHibernate.NTestRow: SELECT
ntestrow0_.Id as Id0_0_, ntestrow0_.Name as Name0_0_ FROM
NHibernateTestTable ntestrow0_ WHERE ntestrow0_.Id=?
NHibernate.Impl.SessionFactoryImpl: DEBUG - Instantiated session
factory
NHibernate.Impl.SessionFactoryImpl: DEBUG - Checking 0 named HQL
queries
NHibernate.Impl.SessionFactoryImpl: DEBUG - Checking 0 named SQL
queries
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG - Create
WriteSession for this thread.
NHibernate.Impl.SessionImpl: DEBUG - opened session
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG - Create
Transaction in this thread.
NHibernate.Transaction.AdoTransaction: DEBUG - Begin (Unspecified)
NHibernate.Connection.DriverConnectionProvider: DEBUG - Obtaining
IDbConnection from Driver
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG -
GetSessionForWrite(1) IsSessionCreator:True
NHibernate.Event.Default.AbstractSaveEventListener: DEBUG - transient
instance of: Crestron.Tools.Core.UnitTests.NHibernate.NTestRow
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener: DEBUG -
saving transient instance
NHibernate.Event.Default.AbstractSaveEventListener: DEBUG - generated
identifier: 416cef169af66261, using strategy:
Crestron.Tools.Core.Data.HibernateIdGenerator
NHibernate.Event.Default.AbstractSaveEventListener: DEBUG - saving
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG - ReleaseSession
(1) IsSessionCreator:True
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG - Committing
database transaction of this thread.
NHibernate.Transaction.AdoTransaction: DEBUG - Start Commit
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
flushing session
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
processing flush-time cascades
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG - dirty
checking collections
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
Flushing entities and processing referenced collections
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
Processing unreferenced collections
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
Scheduling collection removes/(re)creates/updates
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
NHibernate.Impl.Printer: DEBUG - listing entities:
NHibernate.Impl.Printer: DEBUG -
Crestron.Tools.Core.UnitTests.NHibernate.NTestRow{Name=ABC,
Id=416cef169af66261}
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG -
executing flush
NHibernate.AdoNet.ConnectionManager: DEBUG - registering flush begin
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG - Inserting
entity:
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.AdoNet.AbstractBatcher: DEBUG - Opened new IDbCommand, open
IDbCommands: 1
NHibernate.AdoNet.AbstractBatcher: DEBUG - Building an IDbCommand
object for the SqlString: INSERT INTO NHibernateTestTable (Name, Id)
VALUES (?, ?)
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG -
Dehydrating entity:
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.Type.StringType: DEBUG - binding 'ABC' to parameter: 0
NHibernate.Type.StringType: DEBUG - binding '416cef169af66261' to
parameter: 1
NHibernate.Transaction.AdoTransaction: DEBUG - Enlist Command
NHibernate.AdoNet.AbstractBatcher: DEBUG - Closed IDbCommand, open
IDbCommands: 0
NHibernate.AdoNet.ConnectionManager: DEBUG - registering flush end
NHibernate.Event.Default.AbstractFlushingEventListener: DEBUG - post
flush
NHibernate.Impl.SessionImpl: DEBUG - before transaction completion
NHibernate.Transaction.AdoTransaction: DEBUG - IDbTransaction
Committed
NHibernate.Impl.SessionImpl: DEBUG - transaction completion
NHibernate.AdoNet.ConnectionManager: DEBUG - aggressively releasing
database connection
NHibernate.Connection.ConnectionProvider: DEBUG - Closing connection
NHibernate.Transaction.AdoTransaction: DEBUG - IDbTransaction
disposed.
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG - Closing
Session of this thread.
NHibernate.Impl.SessionImpl: DEBUG - closing session
NHibernate.AdoNet.AbstractBatcher: DEBUG - running BatcherImpl.Dispose
(true)
NHibernate.Impl.SessionImpl: DEBUG - running ISession.Dispose()
Crestron.Tools.Core.NHibernate.NHibernateHelper: DEBUG - Create
ReadSession
NHibernate.Impl.SessionImpl: DEBUG - opened session
NHibernate.AdoNet.AbstractBatcher: DEBUG - Opened new IDbCommand, open
IDbCommands: 1
NHibernate.AdoNet.AbstractBatcher: DEBUG - Building an IDbCommand
object for the SqlString: SELECT this_.Id as Id0_0_, this_.Name as
Name0_0_ FROM NHibernateTestTable this_
NHibernate.Loader.Loader: INFO  - SELECT this_.Id as Id0_0_,
this_.Name as Name0_0_ FROM NHibernateTestTable this_
NHibernate.Connection.DriverConnectionProvider: DEBUG - Obtaining
IDbConnection from Driver
NHibernate.AdoNet.AbstractBatcher: DEBUG - Opened IDataReader, open
IDataReaders: 1
NHibernate.Loader.Loader: DEBUG - processing result set
NHibernate.Loader.Loader: DEBUG - result set row: 0
NHibernate.Type.StringType: DEBUG - returning '416cef169af66261' as
column: Id0_0_
NHibernate.Loader.Loader: DEBUG - result row: EntityKey
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.Loader.Loader: DEBUG - Initializing object from DataReader:
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.Persister.Entity.AbstractEntityPersister: DEBUG - Hydrating
entity:
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.Type.StringType: DEBUG - returning 'ABC' as column:
Name0_0_
NHibernate.Loader.Loader: DEBUG - done processing result set (1 rows)
NHibernate.Driver.NHybridDataReader: DEBUG - running
NHybridDataReader.Dispose()
NHibernate.AdoNet.AbstractBatcher: DEBUG - Closed IDataReader, open
IDataReaders :0
NHibernate.AdoNet.AbstractBatcher: DEBUG - Closed IDbCommand, open
IDbCommands: 0
NHibernate.AdoNet.ConnectionManager: DEBUG - aggressively releasing
database connection
NHibernate.Connection.ConnectionProvider: DEBUG - Closing connection
NHibernate.Loader.Loader: DEBUG - total objects hydrated: 1
NHibernate.Engine.TwoPhaseLoad: DEBUG - resolving associations for
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.Engine.TwoPhaseLoad: DEBUG - done materializing entity
[Crestron.Tools.Core.UnitTests.NHibernate.NTestRow#416cef169af66261]
NHibernate.Engine.StatefulPersistenceContext: DEBUG - initializing non-
lazy collections
NHibernate.AdoNet.ConnectionManager: DEBUG - after autocommit
NHibernate.Impl.SessionImpl: DEBUG - transaction completion
NHibernate.AdoNet.ConnectionManager: DEBUG - aggressively releasing
database connection
NHibernate.Impl.SessionImpl: DEBUG - running ISession.Dispose()
NHibernate.Impl.SessionImpl: DEBUG - closing session
NHibernate.AdoNet.AbstractBatcher: DEBUG - running BatcherImpl.Dispose
(true)




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