openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LongkerDandy <longkerda...@gmail.com>
Subject JPQL delete with subquery
Date Thu, 24 Mar 2011 17:53:52 GMT
Hi

I can't figure out this.
I want to delete all the MOVIE entities which doesn't contain any files.

entityManager.createQuery("DELETE FROM MOVIE m WHERE m IN (SELECT em FROM
MOVIE em LEFT JOIN em.files f WHERE em.files IS NULL)").executeUpdate();

And I got the exception:

(<openjpa-2.0.1-r422266:989424 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: "Encountered "m IN" at
character 27, but expected: ["(", "*", "+", "-", ".", "/", ":", "<", "<=",
"<>", "=", ">", ">=", "?", "ABS", "ALL", "AND", "ANY", "AS", "ASC", "AVG",
"BETWEEN", "BOTH", "BY", "CONCAT", "COUNT", "CURRENT_DATE", "CURRENT_TIME",
"CURRENT_TIMESTAMP", "DELETE", "DESC", "DISTINCT", "EMPTY", "ESCAPE",
"EXISTS", "FETCH", "FROM", "GROUP", "HAVING", "IN", "INDEX", "INNER", "IS",
"JOIN", "KEY", "LEADING", "LEFT", "LENGTH", "LIKE", "LOCATE", "LOWER",
"MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "OBJECT", "OF", "OR",
"ORDER", "OUTER", "SELECT", "SET", "SIZE", "SOME", "SQRT", "SUBSTRING",
"SUM", "TRAILING", "TRIM", "TYPE", "UPDATE", "UPPER", "VALUE", "WHERE",
<BOOLEAN_LITERAL>, <DATE_LITERAL>, <DECIMAL_LITERAL>, <IDENTIFIER>,
<INTEGER_LITERAL>, <STRING_LITERAL>, <TIMESTAMP_LITERAL>, <TIME_LITERAL>]."
while parsing JPQL "DELETE FROM MOVIE m WHERE m IN (SELECT em FROM MOVIE em
LEFT JOIN em.files f WHERE em.files IS NULL)".


Any hint?Thanks
LongkerDandy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message