1 Reply Latest reply on Jul 25, 2006 8:45 AM by Carsten Rudat

    Problems with EJB-QL - not empty, OR

    Carsten Rudat Novice

      Hi all,

      I tried to find some entities where a relation (relation) is null or a specific attibute of a related entity is x:

      SELECT o FROM MyObject o WHERE (o.relation is empty) OR ((o.relation is not empty) AND (o.relation.attribute LIKE 'x'))

      But this doesn't work. Debug enabled, I see the SQL-Statement (MySQL) and I guess the paranthesis are wrong:

      select ... where ... not (exists (select ...)) or (exists (select ...)) and (...attribute like 'x'))

      I need paranthesis around the last two blocks, but I realy don't know how?!

      Any help, thank you!