]
Tristan Tarrant updated ISPN-9865:
----------------------------------
Sprint: DataGrid Sprint #31
Query is failing if custom classes are used inside of the cache
---------------------------------------------------------------
Key: ISPN-9865
URL:
https://issues.jboss.org/browse/ISPN-9865
Project: Infinispan
Issue Type: Bug
Components: Embedded Querying, WildFly modules
Affects Versions: 9.4.5.Final
Environment: Wildfly server with ISPN modules and ISPN subsystem to configure
caches
Reporter: Wolf-Dieter Fink
Assignee: Nistor Adrian
Priority: Major
Attachments: install1-standalone-local.cli, install2-standalone-local.cli
A simple query for a cache which contains User classes will fail for queries with the
error below.
UserData class for the cache:
public class Test implements Serializable {
private int testId;
public Test(){}
public Test(int myId) {this.testId = myId;}
public int getTestId() {return animalId;}
public void setTestId(int testId) { this.testId = testId;}
}
Simple EJB for test
@Singleton
@Startup
public class TestInfinispanQuery4EAPConfig {
@Resource(lookup =
"java:jboss/datagrid-infinispan/container/jdg-container/cache/EAPcache")
private Cache<String, Object> cache;
@PostConstruct
public void LoadDBToMemory() {
cache.put("1", new Test(2, 0));
cache.put("2", new Test(2, 0));
cache.put("3", new Test(1, 0));
QueryFactory queryFactory = Search.getQueryFactory(cache);
Query q = queryFactory.from(Test.class).having("testId").eq(2).build();
int size = q.getResultSize();
System.out.println("result = " + size);
}
}
Caused by: java.lang.IllegalStateException: ISPN028510: Unknown entity name
org.infinispan.wfink.web.Test
at
org.infinispan.objectfilter.impl.syntax.parser.QueryResolverDelegateImpl.registerPersisterSpace(QueryResolverDelegateImpl.java:60)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.entityName(QueryResolver.java:6683)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.persisterSpaceRoot(QueryResolver.java:1302)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.persisterSpace(QueryResolver.java:1203)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.persisterSpaces(QueryResolver.java:1144)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.fromClause(QueryResolver.java:1060)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.selectFrom(QueryResolver.java:969)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.querySpec(QueryResolver.java:487)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.queryStatement(QueryResolver.java:388)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.queryStatementSet(QueryResolver.java:308)
at
org.infinispan.objectfilter.impl.ql.parse.QueryResolver.statement(QueryResolver.java:241)
at org.infinispan.objectfilter.impl.ql.QueryParser.resolve(QueryParser.java:81)
at org.infinispan.objectfilter.impl.ql.QueryParser.parseQuery(QueryParser.java:69)
at
org.infinispan.objectfilter.impl.syntax.parser.IckleParser.parse(IckleParser.java:19)
at
org.infinispan.query.dsl.embedded.impl.QueryEngine.lambda$parse$1(QueryEngine.java:695)
at
org.infinispan.query.dsl.embedded.impl.QueryCache.lambda$get$ab3121d1$1(QueryCache.java:73)
at org.infinispan.compat.FunctionMapper.apply(FunctionMapper.java:40)
at
org.infinispan.commands.write.ComputeIfAbsentCommand.perform(ComputeIfAbsentCommand.java:104)
at
org.infinispan.interceptors.impl.CallInterceptor.visitCommand(CallInterceptor.java:29)
at
org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextThenAccept(BaseAsyncInterceptor.java:100)
at
org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:672)