[hibernate-dev] Querying Inifinispan -- Help Needed

Vinoth s.venoth at gmail.com
Wed Nov 18 23:03:22 EST 2009


Hi,

I have a problem in getting through the querying feature of infinispan. I am
using the technical preview listed in this wiki
page<http://www.jboss.org/community/wiki/QueryingInfinispan>with the
help of the sample code provided in the same page.

I used the following properties for the second argument in QueryHelper
Constructor.
#hibernate.properties
hibernate.search.default.directory_provider
org.hibernate.search.store.FSDirectoryProvider
hibernate.search.default.indexBase=/usr/vin/lucene/indexes

This is my class for Hibernate Search

@ProvidedId
@Indexed
public class Item {

    @Field
    private String name;
    @Field
    private String description;

...// getters and setters
}

I have included the @ProvidedId since QueryHelper instantion validates the
classes based on this annotation.
*Note :: QueryHelper.validateClasses() -- This is to check that both the
@ProvidedId is present and the the @DocumentId is not present. This is
because don't want both of these 2 annotations used at the same time.*

When I used the @Indexed annotation for the above class, it throws an
exception while instantiating the QueryHelper.

<Exception Snippet>
java.lang.NullPointerException
        at
org.hibernate.search.engine.DocumentBuilderIndexedEntity.init(DocumentBuilderIndexedEntity.java:151)
        at
org.hibernate.search.engine.DocumentBuilderContainedEntity.<init>(DocumentBuilderContainedEntity.java:93)
        at
org.hibernate.search.engine.DocumentBuilderIndexedEntity.<init>(DocumentBuilderIndexedEntity.java:128)
        at
org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:409)
        at
org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:119)
        at
org.infinispan.query.backend.QueryHelper.<init>(QueryHelper.java:87)
<Exception Snippet>

When I removed that @Indexed annotation, QueryHelper got instantiated but it
throwed some exception when it hits CacheQuery.getBasicQuery() method, where
it forms lucene query string with the help of QueryParser.

org.hibernate.HibernateException: There are no mapped entities. Don't forget
to add @Indexed to at least one class.

Please let me know if I missed anything here.

-- 
Cheers,
Vinoth



More information about the hibernate-dev mailing list