It looks like the result set mapping of nested joins isn't quite
working (Assembla link below). Unrolling the joins is an effective
workaround, but it's a bit ugly (and hurts composability).
For both the failing inner and outer join test example, the underlying
problem is that the wrong ResultSetMapper is used. In particular,
ExportedSelectElement uses the mapper of the referred SelectElement.
I think it should be using "its" relation for the ResultSetMapper
instead of the referred view, but I'm getting slightly lost in the
details. Does this make sense?
This feels like something that shouldn't be that hard to fix, but I'm
having trouble seeing it.
Pete
http://www.assembla.com/spaces/squeryl/tickets/40-nested-joins-aren-t-mapped-correctly
Given the test data in the test class, I think aQuery and aQuery2
should return the same results. The result row is correct in any
case. When I looked at it before, it looked like the wrong
ResultSetMapper was being consulted when populating the final result
from the result set row. Since there were no result columns in the
ResultSetMapper it was using, isNoneInOuterJoin() was returning true.
Pete
Select
A3.name as A3_name,
A3.id as A3_id,
q4.B8_name as q4_B8_name,
q4.B8_aId as q4_B8_aId,
q4.B8_id as q4_B8_id
From
A A3
left outer join (Select
B8.name as B8_name,
B8.aId as B8_aId,
B8.id as B8_id
From
B B8
) as q4 on (A3.id = q4.B8_aId)
ResultSetRow:[a one:String,1:Integer,b one:String,1:Integer,1:Integer]
darn... no go
2011/4/15 Maxime Lévesque <maxime....@gmail.com>:
Pete
2011/4/18 Maxime Lévesque <maxime....@gmail.com>: