objectbox / objectbox/objectbox-java
Can't use query ForEach() with Order()
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.6k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Description
I got that exception message when i tried to use foreach function with order list:
"This method is currently only available for unordered queries"
Its not make any sense because I can just query with order and make forEach manually in my code and it will work. Weird a bit.
Issue Basics
ObjectBox v1.1.0
It can reproduce.
Code
final Box<CallRemindersData> box = objectBox.boxFor(CallRemindersData.class);
final QueryBuilder<CallRemindersData> callRemindersDataQueryBuilder = box.query().order(CallRemindersData_.notificationTime);
callRemindersDataQueryBuilder .build().forEach()
The code that make it (Query.java):
if (hasOrder) {
throw new UnsupportedOperationException("This method is currently only available for unordered queries");
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Query.java at the hasOrder check that throws UnsupportedOperationException, then inspect the surrounding forEach implementation and query execution behavior. Reproduce the Java example with an ordered query and verify that forEach completes in order without the exception, adding or running the relevant existing tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100