Hi,
i am currently writing my final dissertation in university with the topic of integrating search functionalities into an existing web application and want to use Hibernate Search.
But i am struggling with the indexing of entities in the already existing application.
It seems like the indexing is not working, because no index files are generated when i create a new entity. Also, the base index directory configured in the hibernate configuration is not created when i start the application.
The application uses the Spring Framework and Hibernate Core with hibernate-jpa 2.0 (see pom.xml).
I get no errors when executing the application, but there is an info concerning Hibernate Search:
INFO AnnotationSessionFactoryBean:780 - Building new Hibernate SessionFactory
INFO HibernateSearchEventListenerRegister:75 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.I read that i don´t need to integrate these listeners when using hibernate annotations, so this can´t be the source of the problem, right?
Extract from pom.xmlCode:
<dependencies>
...
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>4.3.0.Final</version>
</dependency>
</dependencies>
Extract from applicationContext.xmlCode:
<!-- Configuration of Hibernate Session -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="de.user.server.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">${jdbc.debug}</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.id.new_generator_mappings">true</prop>
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<prop key="hibernate.hbm2ddl.import_files">import.sql</prop>
<prop key="hibernate.c3p0.idle_test_period">28680</prop>
<prop key="hibernate.search.default.directory_provider">filesystem</prop>
<prop key="hibernate.search.default.indexBase">H:/indexes</prop>
</props>
</property>
<!-- hibernate-envers for versioning of entities -->
<property name="eventListeners">
<map>
<entry key="post-insert" value-ref="envers" />
<entry key="post-update" value-ref="envers" />
<entry key="post-delete" value-ref="envers" />
<entry key="pre-collection-update" value-ref="envers" />
<entry key="pre-collection-remove" value-ref="envers" />
<entry key="post-collection-recreate" value-ref="envers" />
</map>
</property>
</bean>
Text.javaCode:
@Entity
@Indexed
@Connectable(modelClass = ModelClassEnum.TEXT)
public class Text extends AbstractDataObject {
/**
* Value generated automatically by eclipse.
*/
private static final long serialVersionUID = 8096234710520978913L;
private String text;
public Text() {
}
@Lob
@Field (name="text",index=Index.YES, analyze=Analyze.YES,store=Store.YES)
public String getText() {
return this.text;
}
public void setText(String text) {
this.text = text;
}
}
AbstractDataObject.javaCode:
@Entity
@Audited
@Inheritance(strategy = InheritanceType.JOINED)
public class AbstractDataObject extends BaseDomainModel {
private Long objectId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@DocumentId
public Long getObjectId() {
return objectId;
}
}
I hope you can help me ,i am looking forward to your answers.
Kind regards,
hbsnovice