select pd from com.soffid.iam.model.UserEntity as usuari inner join usuari.userType as tipus inner join tipus.policies as politica with politica.type='M' inner join politica.passwordDomain pd where usuari.id= :userId and pd.tenant.id = :tenantId
select distinct pd from com.soffid.iam.model.UserEntity as user join user.accounts as ua join ua.account.system.passwordDomain as pd where pd.tenant.id =:tenantId and user.id=:id