Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Problem with IItemQuery (NPE)

Hi,

I have a problem with an item query. My item holds a reference of
IItemHandles. To query all of my items that hold a certain IItemHandle
as reference I use the following IItemQuery:

IQueryService queryService = getService(IQueryService.class);
MyItemQueryModel myItemQueryModel =
BaseMyItemQueryModel.MyItemQueryModel.ROOT;
IItemQuery myItemQuery =
IItemQuery.FACTORY.newInstance(myItemQueryModel);

myItemQuery.filter(myItemQueryModel.relatedItems()._contains(itemHandle));
IItemQueryPage queryItems = queryService.queryItems(myItemQuery,
IQueryService.EMPTY_PARAMETERS,
IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);

The problem is that the last method invocation
(queryService.queryItems(..)) throws a NullPointerException (see stack
trace below). I used the debugger but could not find any problem so far.
All created objects are not null. Besides, the EReference relatedItems
in the ecore model has set the queryableProperty annotation.

What is strange, the same approach worked well for a similar item query
that tries to find all of my items that hold a reference to an own
ISimpleItem.

Is is not allowed to hold a reference to IItemHandles?

Thanks for your help!
Andreas

------

java.lang.NullPointerException
at
com.ibm.team.repository.service.internal.query.sqlgen.JoinStepWithJoinTable.<init>(JoinStepWithJoinTable.java:35)
at
com.ibm.team.repository.service.internal.query.sqlgen.TableJoins.addNewManyJoin(TableJoins.java:234)
at
com.ibm.team.repository.service.internal.query.sqlgen.TableJoins.addJoinForFeature(TableJoins.java:195)
at
com.ibm.team.repository.service.internal.query.sqlgen.TableJoins.addTablesFromPath(TableJoins.java:168)
at
com.ibm.team.repository.service.internal.query.sqlgen.TableJoins.initialize(TableJoins.java:62)
at
com.ibm.team.repository.service.internal.query.sqlgen.TableJoins.<init>(TableJoins.java:49)
at
com.ibm.team.repository.service.internal.query.sqlgen.QueryGenerator.toSqlOn(QueryGenerator.java:54)
at
com.ibm.team.repository.service.internal.query.sqlgen.QueryGenerator.toSqlQuery(QueryGenerator.java:44)
at
com.ibm.team.repository.service.internal.query.sqlgen.SqlQueryGenerator.generate(SqlQueryGenerator.java:40)
at
com.ibm.team.repository.service.internal.RdbRepositoryDataMediator.queryData(RdbRepositoryDataMediator.java:780)
at
com.ibm.team.repository.service.internal.QueryService.performQuery(QueryService.java:525)
at
com.ibm.team.repository.service.internal.QueryService.doExecuteItemQuery(QueryService.java:382)
at
com.ibm.team.repository.service.internal.QueryService.access$0(QueryService.java:379)
at
com.ibm.team.repository.service.internal.QueryService$1.run(QueryService.java:216)
at
com.ibm.team.repository.service.internal.QueryService$1.run(QueryService.java:1)
at
com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:289)
at
com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:218)
at
com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:77)
at sun.reflect.GeneratedMethodAccessor35.invoke(null)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:368)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:353)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:54)
at $Proxy34.runInTransaction(null)
at
com.ibm.team.repository.service.internal.QueryService.executeItemQuery(QueryService.java:207)
at
com.ibm.team.repository.service.internal.QueryService.queryItems(QueryService.java:806)
at sun.reflect.GeneratedMethodAccessor38.invoke(null)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:368)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:353)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:54)
at $Proxy51.queryItems(null)
at com.example.service.internal.MyItemService$6.run(MyItemService.java:521)
at com.example.service.internal.MyItemService$6.run(MyItemService.java:1)
at
com.ibm.team.repository.service.internal.TransactionService$1.run(TransactionService.java:102)
at
com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:449)
at
com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:263)
at
com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:218)
at
com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:77)
at
com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:66)
at sun.reflect.GeneratedMethodAccessor51.invoke(null)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:368)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:353)
at
org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:54)
at $Proxy35.runInTransaction(null)
at
com.ibm.team.repository.service.AbstractService.runInTransaction(AbstractService.java:591)
at
com.example.service.internal.MyItemService.getMyItemsWithRelatedItem(MyItemService.java:513)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Mar 27 '08, 5:51 a.m.

Question was seen: 5,892 times

Last updated: Mar 27 '08, 5:51 a.m.

Confirmation Cancel Confirm