[infinispan-dev] Querying Infinispan -- Help Needed

Vinoth s.venoth at gmail.com
Thu Nov 19 02:02:16 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 instantiation 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.

Thanks in advance,
Vinoth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20091119/be2d092b/attachment-0002.html 


More information about the infinispan-dev mailing list