Suppose we have an entity "City" with an element collection "names" of type 
Map<String, String>, mapping language codes to names.

Now what's the best way to write a JPQL query for all cities without an English 
name?

Is there an alternative to using a subquery like this:

select city from City city 
where not exists 
  (select c from City c join c.names 
   where KEY(c.names) = 'en' and city = c) 


I would like to write something like

select c from City c where 'en' NOT MEMBER OF KEY(c.names)

but OpenJPA 2.1.0 produces a parser error.

I think this is correct by the JPA 2.0 spec, but wouldn't that be a consistent 
and useful extension of the spec to regard

KEY(identification_variable)

as a collection_valued_path_expresssion, when identification_variable refers to 
a map?

Best regards,
Harald


-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!               
Jetzt informieren: http://www.gmx.net/de/go/freephone

Reply via email to