I have been using NHibernate.Search for some time with our ActiveRecord-project, following the example on
http://using.castleproject.org/display/AR/Using+NHibernate.Search+with+ActiveRecord This has been working very well until recently it stopped working on my dev-machine (however, same source worked in a collegues computer). 2 days of debugging seems to show that there is a flaw when using the NHibernate event system this way. You have to initialize AR before you can modify the NHibernate configuration, and you have no control over when AR will initialize NHibernate afaik. This lead to the problem that my machine initializes NHibernate before I register the eventlisteners, as shown in my logfiles: >From my Castle-log: 2009-01-21 12:09:39,589 [10] DEBUG Castle.Facilities.ActiveRecordIntegration.ActiveRecordFacility - Initializing AR Facility 2009-01-21 12:09:39,667 [10] INFO Castle.Facilities.ActiveRecordIntegration.ActiveRecordFacility - Registering SessionFactory named 'activerecord.sessionfactory' for the root type Castle.ActiveRecord.ActiveRecordBase: Castle.ActiveRecord.Framework.SessionFactoryHolder 2009-01-21 12:09:41,961 [10] INFO Castle.Facilities.ActiveRecordIntegration.ActiveRecordFacility - No Transaction Manager registered on Kernel, registering AR Transaction Manager >From NHibernate-log: 2009-01-21 12:09:42,444 [10] DEBUG NHibernate.Impl.SessionFactoryImpl - instantiating session factory with properties: {use_reflection_optimizer=True, hibernate.search.analyzer=Lucene.Net.Analysis.SimpleAnalyzer, Lucene.Net..... And from my app-log: 2009-01-21 12:09:43,567 [10] DEBUG XXXXX.GlobalApplication - Adding listener to the different events On the machine that is working, I can see that my logging fires right before the entry in the NHibernate-log, which indicates that I'm on the right track. Solution that seems to work is to initialize FullTextIndexEventListener manually, and it doesn't seem to bother that it might run twice. Is there a better solution than this? I saw that you have some sort of discussion about the NH2.0 event-system, would that solve this issue perhaps? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
