Bug 257 : Join on *ToOne which is optional should cascade the outer join
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.5.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
21/03/2010
Updated 
21/03/2010
Type 
Bug
 
Attachments 
No attachments

The join from A -> B is optional and the join from B -> C is not optional.

Joining from a to b and b.c ... then the outer join should cascade and both joins should be left outer joins.

The bug is that the second join is not an outer join and should be.

public void test() {
        
        Query<EOptOneA> query = Ebean.find(EOptOneA.class)
            .join("b")
            .join("b.c");
        
        query.findList();
        String sql = query.getGeneratedSql();
        
        Assert.assertTrue(sql.contains("left outer join eopt_one_b"));
        Assert.assertTrue(sql.contains("left outer join eopt_one_c ebc"));
    }
 
Rob 21 Mar 06:00
Added test

Added a test that reproduces the problem.

woResponse

Upload a file