You can’t just use random From
/Root
objects in a query. These objects are bound to the query through which they were created. This topic was discussed multiple times already. Use the search feature: java.lang.IllegalArgumentException: Already registered a copy: SqmBasicValuedSimplePath