I keep getting multiple joins when I use multiple anyOf( ) functions in my expression, which is returning too many results. How do I get it down to one join instead?
Each time you use anyOf() in your expression, you get another join in your database. For example, the TopLink expression: emp.anyOf(“managedEmployees”).get(“lastName”).equal(“Smith”).and(emp.anyOf(“managedEmployees”).get(“firstName”).equal(“John”)); will return any Employee who manages a John or a Smith, not just John Smith. This is because a separate join is performed for each anyOf() . To force a single join, the same anyOf node must be used for each query: Expression managedEmployees = emp.anyOf(“managedEmployees”); … managedEmployees.get(“lastName”).equal(“Smith”).and(managedEmployees.get(“firstName”).
Related Questions
- I keep getting multiple joins when I use multiple anyOf( ) functions in my expression, which is returning too many results. How do I get it down to one join instead?
- I keep getting multiple joins when I use multiple anyOf( )s in my expression, which is returning too many results. How do I get it down to one join instead?
- In my search results carers are returning that live further than the entered 10km from my postcode, why is this?