-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Search-Index not created
PostPosted: Tue Jul 07, 2015 7:27 am 
Newbie

Joined: Tue Jul 07, 2015 6:19 am
Posts: 1
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.xml
Code:
<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.xml
Code:
<!-- 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.java
Code:
@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.java
Code:
@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


Top
 Profile  
 
 Post subject: Re: Hibernate Search-Index not created
PostPosted: Wed Jul 15, 2015 6:49 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hello,

The error means that the hibernate-search-orm.jar is not found at runtime. The dependencies which you are showing in your pom.xml are correct but they only show what is being used at compile time.
So how are you testing this? For example if you're copying your built application into a Tomcat container (or something similar) but are not including all Hibernate Search dependencies in there as well, you would have that warning message.

Another possibility is that you're using incompatible versions. I can see you're using Hibernate Search version 4.3.0.Final, but which version of Hibernate ORM are you using?
Hibernate Search 4.3.0.Final requires Hibernate ORM 4.2.2.Final.

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


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