Greetings, I am having a hard time wrapping my head around the behavior I am seeing using CriteriaBuilder.
I have this code block constructing a query (please notice the "job" related configurations have been commented out): This results in the following SQL: So far, so good. Now, in the method that builds this query, I am actually passing in a "Job" object that I want to have set on the MetricBaseline object I am creating (using builder.createQuery(MetricBaseline.class) + multiselect + constructor defined on MetricBaseline). I was hoping would work, but that does not seem to be the case. So, I am now trying to construct a multi-root query. However, if I uncomment the "job" related code from the Java snippet I posted above - I see the following SQL get created: Notice how OPPORTUNITY t0 is now CROSSED JOIN'd to OPPORTUNITY t1?? I find it confusing because merely adding the additional is causing a CROSS JOIN to OPPORTUNITY - even though t1 (the OPPORTUNITY CROSS JOIN) and t5 (the JOB CROSS JOIN) are not being related in any way. By adding the JOB root, now my CONTACT and USER tables are being joined to the CROSS JOIN table t1 and not the "real" root t0!!! This really causes me problems because I have a WHERE clause on t0 (t0.status = ?) that isn't getting applied to t1 - so my query is broken. Furthermore, since I don't know where this CROSS JOIN is coming from, I cannot create an expression to relate it to t0. Now, I am hoping the problem/issue is obvious enough someone can help me without me having to post all my entities with their property mappings. All the mappings involved are @OneToOne (some optional, some not) - but if the specific code is required - just let me know and I can provide. Thanks in advance. Andy -- View this message in context: http://openjpa.208410.n2.nabble.com/Multi-Root-queries-using-CriteriaBuilder-result-in-Additional-CROSS-JOIN-tp7583546.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
