|
Steve Ebersole, to give some more background. Atm, the HibernateSearchIntegrator registers the FullTextIndexEventListener during Integrator#integrate. The listeners is receiving ORM life cycle events and based on these events updating the Lucene index. The listeners has a second job of creating the Search factory - SearchFactoryImplementor. It does that on the Integrator#integrate call. At this point of time the ORM SessionFactory is not built yet, which means it cannot be used.
So far that was no issue, but now we have a use case where we during the creation of the SearchFactoryImplementor want to read some information from the database. For that we would need a ready SessionFactory, so that we can create a temporary a_Session_. So what I am proposing is to just register the FullTextIndexEventListener during Integrator#integrate. We don't create the HibernateSearchIntegrator. For that we create a SessionFactoryObsever which does the creation once it gets the callback that the SessionFactory is ready.
Not only would that solve our use case, but I also think from a pure timing point of view it makes sense to wait until the SessionFactory is ready. After all Search builds on top of a working ORM setup.
|