-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An empty result may be returned when using ReactiveNeo4jTemplate's findAll method with a Statement parameter. Kotlin + Coroutines #2717
Comments
Could you please provide more details on this? I am somehow lost to find the real problem.
|
The main problem is with searching for all elements based on a given criteria (for which I have a mechanism that converts regardless of the type of persistence used). The method for finding all elements without a criteria works well and retrieves all elements, but when I use a criteria, that method doesn't find any element. override fun findAll(criteria: Statement?, limit: Int?, offset: Long?, sort: Sort?): Flow<T> {
if (limit != null && limit <= 0) {
return emptyFlow()
}
return criteria?.let {
template.findAll(it, clazz.java)
.subscribeOn(Schedulers.parallel())
.asFlow()
} ?: findAll()
} I use the During testing, changing the call to use findAll without criteria and manually filtering it works. However, it is ideal for it to work with criteria. |
The given query |
But how do you come to the conclusion that there should be another or updated |
Hi @meistermeier the example tests is in this class Perhaps in the example I have shown it is not well appreciated. When testing and debugging the application, I was able to verify that, although the criterion is converted into a correct Statement, the findAll (given a Statement) and find (given a Statement) continue to fail. I am not sure if I am instantiating the configuration correctly so that Neo4jTemplate works correctly with search criteria. |
Now I at least understand how the |
Thank you very much. I will review the answer on StackOverflow and try not to use |
As I said, this is just my interpretation and it might be also something else. |
I have an issue with ReactiveNeo4jTemplate and the findAll method using a Statement. All the template methods work except this one, which returns an empty result even though the database has nodes that match the Statement. I have a test that updates all the elements that match certain criteria, but it fails because the findAll with Statement does not return any value, so it does not perform the update. However, the findAll without any search criteria finds all the elements.
This is the implementation of the method that updates any data in a Statement.
The implementation of my Neo4jRepository interface is located in the SimpleNeo4jRepository class.
The configuration class is as follows
This is the test that is failing when I use findAll with Statement, if I change it to just use findAll without Statement the test passes because of course it finds the node (but that's not the idea)
This code is to test if the findAll function was working properly with the Criteria to Statement Converter.
Excerpts from the prints
all persons ✅: [Person(name=arletha.dietric, age=67)]
QUERY ➡️ MATCH (n:Person) WHERE n.name = 'arletha.dietric' RETURN n
all persons ❌: [Person(name=arletha.dietric, age=67)]
The text was updated successfully, but these errors were encountered: