Bug 219 : Autofetch tuned query with join and no properties ... and join required for where clause
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.4.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
18/02/2010
Updated 
18/02/2010
Type 
Bug
 
Attachments 
No attachments

See Mario's test case of MainAutoQueryTune1

private void tuneJoin()
        {
                List<Order> list = Ebean.find(Order.class)
                        .setAutofetch(true)
                        .join("customer")
                        .where()
                        .eq("status", Order.Status.NEW)
                        .eq("customer.name", "Rob")
                        .order().asc("id")
                        .findList();

                for (Order order : list)
                {
                        System.out.println(order.getId() + " " + order.getOrderDate());
                }
        }
 
Rob 18 Feb 11:29
The issue

The issue here was in SqlTreeBuilder ... specifically at the point of the IncludesDistiller ... where it determines extra joins required for the WHERE and ORDER BY clauses.

It was using a different check to see if a particular join/include had already been included in the query (it was just checking for not null).

Fixed by collecting all the actual joins included by the select (so as to bypass checking for (no property joins) which was the problem.

Fixed in HEAD.

woResponse

Upload a file