Thank Sane.
Indeed, InfiniSpan/query seems pretty hard to understand from the first sight, but I'll have a deeper look as soon as possible.
I tried to add my annotated POJO indexed by Hibernate Search (I run Hibernate with Spring):
applicationContext.xml
Code:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitPostProcessors" ref="persistenceUnitPostProcessor"/>
...
</bean>
<bean id="persistenceUnitPostProcessor" class="org.mythicforge.chronos.dao.jpa.ConfigurationPostProcessor"/>
ConfigurationPostProcessor.java
Code:
public class ConfigurationPostProcessor implements PersistenceUnitPostProcessor {
@Override
public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui) {
SearchMapping mapping = new SearchMapping();
mapping.entity(Action.class).indexed();
pui.getProperties().put("hibernate.search.model_mapping", mapping);
} // postProcessPersistenceUnitInfo().
}
Action.java
Code:
@Indexed
public class Action implements Serializable {
@DocumentId
public Integer getId() {
...
But when I run th following code :
Code:
FullTextEntityManager searcher = Search.getFullTextEntityManager(entityManager);
searcher.purgeAll(Action.class);
I got an error indicating that the Action.class is not recognized :
Code:
java.lang.IllegalArgumentException: org.mythicforge.model.rule.Action is not an indexed entity or a subclass of an indexed entity
at org.hibernate.search.impl.FullTextSessionImpl.purge(FullTextSessionImpl.java:148)
at org.hibernate.search.impl.FullTextSessionImpl.purgeAll(FullTextSessionImpl.java:125)
at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.purgeAll(FullTextEntityManagerImpl.java:117)
at org.mythicforge.chronos.dao.jpa.SearchDao.resetIndexes(SearchDao.java:120)