Consider the following syntax (or something similar, the assignment of a specific alias is the key):
Query query = Ebean.find(Asset.class) .join("attributes", "attributes.definitionId, attributes.value", "a1") .join("attributes", "attributes.definitionId, attributes.value", "a2") .where() .eq("a1.definitionId", 57L) .eq("a1.value", "Quux") .conjunction() .eq("a2.definitionId", 56L) .eq("a2.value", "Foo") .query();
> So, I need to have multiple inner joins on the same column, like so:>> SELECT DISTINCT(ass.a_id)> FROM assets ass> INNER JOIN attributes a1 on ass.a_id = a1.att_a_id> INNER JOIN attributes a2 on ass.a_id = a2.att_a_id> WHERE (a1.att_s_id = :defId1 AND a1.att_value = :val1) AND> (a2.att_s_id = :defId2 AND a2.att_value = :val2)