Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support serialization of any() paths in Querydsl JPA #1062
This is the same as #904, but for the JPA module. I can use any() in predicates in tests that run on the same JVM. But when running an integration tests, where I have a client that serializes a predicate containing any(), and a server which deserializes the predicate (on another JVM), then I'm getting this exception when attempting to execute the predicate (via Spring Data JPA):
I reported another bug earlier, which also steemed from my setup of having a predicate serialized on one JVM and deserialized on another, which was caused by a bug in the caching code. In case it's releated it's #481.
I toke the test from the referenced PR, adjusted it to my env and changed it to create a file with the serialized predicate on the first run. When running the test a second time the file is read and the predicate executed. This ensures serialization and deserialization happen on different JVMs.This is of course not a proper solution to be committed, but makes the issue reproducible (the test in the PR works fine here too).
The relevant part being the file handling of course.
At the site of the exception:
Inspecting the variables I can see that there's a hashcode mismatch, which is also shown in my test:
Thus, the contains check on the Set in ValidatingVisitor fails.
Edit: Actually, the predicates having different hashcodes might not be a problem, but expr.getRoot() (first image) evaluating to a different hashcode than the standort object in the known set is. I verified this is the case, but confused this in the second image.