2 Replies Latest reply on Jun 23, 2011 2:29 PM by mstuder

    Unknown type metadata when using cache queries

    mstuder

      Hi everybody,

       

      I'm trying to use infinispan's cache queries with a simple entity that has a String as the corresponding id (class is @Indexed with the corresponding String id field marked as @DocumentId).  I've been closely following the steps outlined at http://community.jboss.org/wiki/QueryingInfinispan but consistently get a "org.infinispan.CacheException: Unknown type metadata [X]" exception where [X] seems to be the first character of the randomly generated string UUID that I'm using as the entity's id. The exception is thrown when calling query.list().

      I also tried with other id types such as Integer, Long and even tried to implement custom key classes marked with @Transformable and implementing corresponding Transformers - but that all didn't help. Did I miss something?

       

      I tried with Infinispan 5.0.0.CR5 and 5.0.0.CR6. The following is a stack trace excerpt:

       

      org.infinispan.CacheException: Unknown type metadata 6

        at org.infinispan.query.backend.KeyTransformationHandler.stringToKey(KeyTransformationHandler.java:100)

        at org.infinispan.query.impl.EntityLoader.load(EntityLoader.java:47)

        at org.infinispan.query.impl.EntityLoader.load(EntityLoader.java:55)

        at org.infinispan.query.impl.CacheQueryImpl.list(CacheQueryImpl.java:148)

       

      Any help is very much appreciated.

       

      Thanks,

      Martin

        • 1. Re: Unknown type metadata when using cache queries
          sannegrinovero

          Hi Martin,

          I'm sorry, it seems I forgot to point this out on the wiki, fixing that.

           

          @DocumentId should not be used with Infinispan Query, it's Hibernate Search specific: useful to deal with database loaded entities when the id doesn't match the database id. When using Infinispan Query you should annotate the objects with both @Indexed and @ProvidedId, and forget about the @DocumentId: the identifier is going to be the key used to store the value in the cache.

           

          thanks for the feedback

          • 2. Re: Unknown type metadata when using cache queries
            mstuder

            Hi Sanne,

             

            yep, that did it! Thank you very much for your fast response!

             

            Best regards,

            Martin