-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: FullTextIndexEventListener not triggered on update
PostPosted: Wed May 06, 2009 4:54 pm 
Newbie

Joined: Wed May 06, 2009 4:38 pm
Posts: 12
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


Top
 Profile  
 
 Post subject: Re: FullTextIndexEventListener not triggered on update
PostPosted: Wed May 06, 2009 5:12 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
This kind of problems are usually related to not having the transactions configured correctly.
take a look into https://www.hibernate.org/441.html,
especially
Code:
<bean id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: FullTextIndexEventListener not triggered on update
PostPosted: Thu May 07, 2009 8:31 am 
Newbie

Joined: Wed May 06, 2009 4:38 pm
Posts: 12
I looked at this link before posting the message, but it doesn't apply to my case because I don't use org.springframework.orm.jpa.JpaTransactionManager as a transaction manager. I use : org.springframework.orm.hibernate3.HibernateTransactionManager (I use hibernate Core without annotations, no JPA).

Switching to JPA could be nice, but it is not scheduled yet on the project roadmap.

Do you have any other docs I could check in my case ?

Thanks for your reply,
Eric


Top
 Profile  
 
 Post subject: Re: FullTextIndexEventListener not triggered on update
PostPosted: Thu May 07, 2009 9:47 am 
Newbie

Joined: Wed May 06, 2009 4:38 pm
Posts: 12
I have understood what is happening.

I am indexing 2 associated entities : Doc and Idx.

Doc is referencing idx through a Set<Idx> property. Both entities are @Indexed. The Set<Idx> property (named idxes) is @IndexEmbedded annotated.

I have not activated update & merge cascading. So when I need to update Idx I do it directly. Idx index files are updated, but not those of Doc, and I search on Doc.

I would like the Doc.idxes index file entries also updated when Idx index file are updated by listeners. Is it possible ? How ?

Best regards,
Eric


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.