-
Bug
-
Resolution: Done
-
Major
-
7.2.4.Final, 8.0.0.CR1
-
None
Reproducer:
import java.util.List; import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.Store; import org.infinispan.Cache; import org.infinispan.configuration.cache.ConfigurationBuilder; import org.infinispan.configuration.cache.Index; import org.infinispan.manager.DefaultCacheManager; import org.infinispan.query.Search; import org.infinispan.query.dsl.Query; import org.infinispan.query.dsl.QueryFactory; public class Test { public static void main(String[] args) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.indexing().index(Index.ALL) .addProperty("default.directory_provider", "ram") .addProperty("lucene_version", "LUCENE_CURRENT"); // Construct a simple local cache manager with default configuration DefaultCacheManager cacheManager = new DefaultCacheManager(builder.build()); // Obtain the default cache Cache<String, Person> cache = cacheManager.getCache(); // Store some entries cache.put("person1", new Person("William", "Shakespeare")); cache.put("person2", new Person("William", "Wordsworth")); cache.put("person3", new Person("John", "Milton")); // Obtain a query factory for the cache QueryFactory<?> queryFactory = Search.getQueryFactory(cache); // Construct a query Query query = queryFactory.from(Person.class).having("name").eq("William").toBuilder().build(); // Execute the query List<Person> matches = query.list(); matches.forEach(person -> System.out.printf("Match: %s", person)); // Stop the cache manager and release all resources cacheManager.stop(); } @Indexed static class Person { @Field(store = Store.YES, analyze = Analyze.NO) String name; @Field(store = Store.YES, analyze = Analyze.NO, indexNullAs = Field.DEFAULT_NULL_TOKEN) String surname; public Person(String name, String surname) { this.name = name; this.surname = surname; } @Override public String toString() { return "Person2 [name=" + name + ", surname=" + surname + "]"; } } }
Stack Trace:
Exception in thread "main" java.lang.IllegalStateException: Unknown entity name com.gustavonalle.infinispan.perf.config.Test.Person
at org.infinispan.objectfilter.impl.hql.FilterQueryResolverDelegate.registerPersisterSpace(FilterQueryResolverDelegate.java:52)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.entityName(GeneratedHQLResolver.java:12784)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.persisterSpaceRoot(GeneratedHQLResolver.java:3064)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.persisterSpace(GeneratedHQLResolver.java:2956)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.persisterSpaces(GeneratedHQLResolver.java:2893)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.fromClause(GeneratedHQLResolver.java:2803)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.selectFrom(GeneratedHQLResolver.java:2704)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.querySpec(GeneratedHQLResolver.java:2182)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.queryExpression(GeneratedHQLResolver.java:2106)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.queryStatement(GeneratedHQLResolver.java:1745)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.queryStatementSet(GeneratedHQLResolver.java:1658)
at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.statement(GeneratedHQLResolver.java:654)
at org.hibernate.hql.ast.spi.QueryResolverProcessor.process(QueryResolverProcessor.java:52)
at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:82)
at org.infinispan.objectfilter.impl.BaseMatcher.parse(BaseMatcher.java:115)
at org.infinispan.query.dsl.embedded.impl.QueryEngine.parse(QueryEngine.java:377)
at org.infinispan.query.dsl.embedded.impl.QueryEngine.buildQuery(QueryEngine.java:81)
at org.infinispan.query.dsl.embedded.impl.EmbeddedQueryBuilder.build(EmbeddedQueryBuilder.java:30)
at com.gustavonalle.infinispan.perf.config.Test.main(Test.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)