I'm expecting that this will be translated into the following HQL query:
INNER JOIN (other tables)
WHERE (GroupID IN (48,53) AND RealEstate.AgencyID = User.UserID) OR (GroupID IN (48,53) AND RealEstate.AgencyID = User.UserID)
(note the parenthesys in the or clause)
But this is the actual translation:
inner join other tables...
where (GroupID in (48 , 53)) and realestate0_.AgencyID=user1_.UserID or (GroupID in (48 , 53)) and realestate0_.AgencyID=user1_.UserID
The logical order of the actual HQL translation isn't right...in this way the two 'and' statements aren't executed before the 'or' operator, like it should be...where am I wrong? Maybe it's a bug of Hibernate implementation?