-->
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.  [ 5 posts ] 
Author Message
 Post subject: Spring config: not creating index
PostPosted: Sat Oct 16, 2010 11:58 am 
Newbie

Joined: Tue Oct 06, 2009 1:40 pm
Posts: 10
Hi.

I suceeded in a project using JPA + Hibernate Search, while I am failing now that the jpa config is embedded in spring xml. Things are writen on database while the lucene index is not populated at all

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceProviderClass" value="org.hibernate.ejb.HibernatePersistence" />
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="${hibernate.dialect}" />
<entry key="hibernate.connection.driver_class" value="${hibernate.connection.driver_class}" />
<entry key="hibernate.connection.username" value="${hibernate.connection.username}" />
<entry key="hibernate.connection.password" value="${hibernate.connection.password}" />
<entry key="hibernate.connection.url"
value="jdbc:${hibernate.connection.database}://${hibernate.connection.host}:${hibernate.connection.port}/${database.name}" />
<entry key="hibernate.max_fetch_depth" value="3" />
<entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />
<entry key="hibernate.ejb.cfgfile" value="hibernate.cfg.xml" />
<entry key="hibernate.search.default.directory_provider"
value="org.hibernate.search.store.FSDirectoryProvider" />
<entry key="hibernate.search.default.indexBase" value="~/.lucene/indexes" />
</map>
</property>
</bean>

The ~/.lucene folder exists.

I call

EntityManager em = emf.createEntityManager();
Search.getFullTextEntityManager(em).createIndexer(Wish.class).startAndWait();

while the app startup, being emf the @autowired EntityManagerFactory.

I can persist an instance of wish and retrieve it but there is no index built, so the full text query fails.
I think I am missing something but can't figure out why, with the same amount of configuration, but with the jpa properties in the standard persistence.xml file, everything was working.

Any advice?


Top
 Profile  
 
 Post subject: Re: Spring config: not creating index
PostPosted: Mon Oct 18, 2010 4:48 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
could you check if the Search listeners need to be registered explicitly when using Spring?
they should be auto-registered, provided you have the correct versions of Hibernate (so also check duplicates and incompatible versions on classpath).
What is the effect of starting the MassIndexer? is it logging anything, throwing errors, or just nothing?

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


Top
 Profile  
 
 Post subject: Re: Spring config: not creating index
PostPosted: Mon Oct 18, 2010 9:01 am 
Newbie

Joined: Tue Oct 06, 2009 1:40 pm
Posts: 10
s.grinovero wrote:
Hi,
could you check if the Search listeners need to be registered explicitly when using Spring?
they should be auto-registered, provided you have the correct versions of Hibernate (so also check duplicates and incompatible versions on classpath).
What is the effect of starting the MassIndexer? is it logging anything, throwing errors, or just nothing?


I solved moving the EMFactory config inside persistence.xml rather than embedded in a bean declaration.
No errors, just no index are created.

This seems to be the official documentation
http://community.jboss.org/wiki/SpringH ... nateSearch
and declare everything in the persistence.xml
I can't find nothing about some listener to declare...


Top
 Profile  
 
 Post subject: Re: Spring config: not creating index
PostPosted: Tue Oct 19, 2010 4:15 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Daniele,
did you understand why? could you create a unit test and open an issue?
If you download the sources, you'll see a new module dedicated to test integrations with Spring.

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


Top
 Profile  
 
 Post subject: Re: Spring config: not creating index
PostPosted: Tue Oct 19, 2010 7:35 am 
Newbie

Joined: Tue Oct 06, 2009 1:40 pm
Posts: 10
The error were somewhere else: http://opensource.atlassian.com/project ... SEARCH-608

and I discovered that is different, when the path is ~/.lucene is taken as a relative path, so under my poroject I got a ~/.lucene folder.
I update the bug.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.