select
testhhh108x0_.id as id1_1_0_,
subs3_.id as id1_0_1_,
testhhh108x1_.id as id1_1_2_,
subs2_.id as id1_0_3_,
testhhh108x0_.name as name2_1_0_,
testhhh108x0_.refId as refId3_1_0_,
subs3_.test_id as test_id2_0_1_,
testhhh108x1_.name as name2_1_2_,
testhhh108x1_.refId as refId3_1_2_,
subs2_.test_id as test_id2_0_3_
from
TestEntity testhhh108x0_
left outer join
SubEntity subs3_
on testhhh108x0_.id=subs3_.test_id
inner join
TestEntity testhhh108x1_
on (
testhhh108x0_.refId=testhhh108x1_.id
)
left outer join
SubEntity subs2_
on testhhh108x1_.id=subs2_.test_id