Hi,
I'm using Hibernate search 3.1.0 with Hibernate Core 3.3.1 GA and Spring without Hibernate annotations.
Following the documentation I have registered event listeners like this :
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">com.itesoft.share.model.HSQLDialectExt
</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider
</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- Location is filtered by Maven build-->
<prop key="hibernate.search.default.indexBase">${ftindex.location}/dev</prop>
<prop key="hibernate.search.analyzer">custom_analyzer</prop>
</props>
</property>
<!-- Manually set Hibernate Search event listeners -->
<property name="eventListeners">
<map>
<entry key="post-update" value-ref="indexListener">
</entry>
<entry key="post-insert" value-ref="indexListener">
</entry>
<entry key="post-delete" value-ref="indexListener">
</entry>
<entry key="post-collection-recreate" value-ref="collectionSearchListener">
</entry>
<entry key="post-collection-remove" value-ref="collectionSearchListener">
</entry>
<entry key="post-collection-update" value-ref="collectionSearchListener">
</entry>
</map>
</property>
</bean>Entities are annotated @Indexed and (it seems) are properly configured because everything works fine when they are indexed on application start up.
On entity insertion, the index are updated and search is retrieving newly created entities.
But index is not updated after an entity update. I have checked it with Luke, modified values are not reflected in the index files.
The entity update code is :
Code:
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void update(final Entity entity) throws DAOException
{
LOG.debug("saving or updating entity instance");
try
{
// Updating entity to database
getSession().merge(entity);
LOG.debug("persist successful");
}
catch (HibernateException re)
{
LOG.error("persist failed", re);
throw new DAOException(re);
}
}
We are using "merge" method.
Any guess of what is missing in the configuration or code to trigger the index files update ?
Thanks,
Best regards,
Eric