Hello karthik, the error you’re getting should be pretty slef-explanatory: Multiple from-elements expose unqualified attribute : id This refers to the where clause in your subquery: WHERE id.queryId = u2.queryId AND id.userId=?1, id here is unqualified and available in multiple tables because it could be referring to the root query entities too. To solve your problem you just have to qualify the id attribute, e.g. from QueryUser qu WHERE qu.id.queryId = u2.queryId AND qu.id.userId=?1. |