Hi Michael,
I replied to your personal email earlier, but am replying to this
email to let the rest of the group know about the plan for this feature.
We currently have a feature under development that will make joining
easier for all queries and should fix a number of the issues we have
with joining both in the TCK and in other tests. When that feature is
done, EJBQL will be able to build a query that looks something like the
following:
ReportQuery query = new ReportQuery(Order.class, new
ExpressionBuilder(Order.class));
ExpressionBuilder builder = query.getExpressionBuilder();
query.returnWithoutReportQueryResult();
query.addAttribute("customer", builder.get("customer"))
Expression exp = builder.getAllowingNull("customer");
query.addNonFetchJoinedAttribute(exp);
Hopefully that will solve both problems,
Tom
Michael Bouschen wrote:
>Hi Tom,
>
>I'm sorry. I just realized I included the wrong EJBQL in my email. The
>generated SQL is correct.
>
>
>
>>Hi Tom,
>>
>>the following EJBQL query uses an identification variable in the SELECT
>>clause that is defined in an OUTER JOIN clause. The generated SQL misses
>>an outer join, but uses an inner join instead.
>>EJBQL: SELECT c FROM Order o JOIN o.customer c
>>
>>
>
>This should be:
>EJBQL: SELECT c FROM Order o LEFT OUTER JOIN o.customer c
>
>
>
>>SQL: SELECT t0.ID, ... FROM CUSTOMER_TABLE t0, ORDER_TABLE t1
>> WHERE (t1.CUST_ID = t0.ID)
>>
>>When adding a WHERE clause that uses the same identification variable,
>>we run into issue of duplicated tables in the generated SQL.
>>EJBQL: SELECT c FROM Order o JOIN o.customer c WHERE c.customerId= 1
>>
>>
>
>This should be:
>EJBQL: SELECT c FROM Order o LEFT OUTER JOIN o.customer c
> WHERE c.customerId= 1
>
>Regards Michael
>
>
>
>>SQL: SELECT t0.ID, ...
>> FROM CUSTOMER_TABLE t0, CUSTOMER_TABLE t2, ORDER_TABLE t1
>> WHERE (((t1.CUST_ID = t0.ID) AND (t2.ID = 1)) AND
>> (t2.ID (+) = t1.CUST_ID))
>>
>>I will file a issue in the glassfish issue tracker for the outer join
>>and do some more testing on the second issue with the duplicated table
>>before creating an issue.
>>
>>Regards Michael
>>
>>
>
>
>
--
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com