Hi,
I am struggling with freeze while executing MassIndexer.startAndWait:
Code:
[Hibernate Search: entityloader-1] DEBUG org.hibernate.loader.Loader - Result row: EntityKey[domain.Category#2], null, EntityKey[domain.Country#1], EntityKey[domain.Continent#1], null, EntityKey[domain.Page#1]
2012-06-19 23:38:59,885 [Hibernate Search: entityloader-1] DEBUG org.springframework.beans.factory.annotation.InjectionMetadata - Processing injected method of bean 'domain.Country': PersistenceElement for transient javax.persistence.EntityManager domain.Country.entityManager
Page should be indexed. It contains @ManyToOne Country which contains @ManyToOne Continent. I use @IndexedEmbedded on country and continent members.
It appears that this error is connected with the fact that all domain objects have EntityManager injected in the following way (I have used Spring Roo to generate the initial code):
Code:
@PersistenceContext
transient EntityManager entityManager;
public static final EntityManager entityManager() {
EntityManager em = new Continent().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em;
}
When I simply remove @PersistenceContext for tests, the project starts correctly.
MassIndexer is started in the service:
Code:
@Service
public class SearcherImpl {
@PersistenceContext
transient EntityManager entityManager;
public SearcherImpl() {
}
@PostConstruct
private void postConstruct() throws InterruptedException {
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
fullTextEntityManager.createIndexer().threadsToLoadObjects(1).threadsForSubsequentFetching(1).batchSizeToLoadObjects(1).startAndWait();
}
...}
I am using Hibernate 4.1.4.Final, Hibernate Search 4.1.1.Final, Spring 3.1.1.RELEASE, JPA, MySQL, Tomcat 7.
Does anyone know what might be wrong? Thanks for help in advance.