openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harald Wellmann" <>
Subject Query for maps not containing a given key
Date Tue, 30 Aug 2011 10:17:59 GMT
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


as a collection_valued_path_expresssion, when identification_variable refers to a map?

Best regards,

NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren:

View raw message