When a JPAQL / HQL delete query is defined using a join as below, the generated SQL is invalid though a select query with the same structure works.
{code} DELETE FROM Employee e WHERE e.task.name=:tname {code}
The failure reported is {code} ... WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] SQL Error: 42000, SQLState: 42000 ... ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] Syntax error in SQL statement "DELETE FROM EMPLOYEE CROSS[*] JOIN TASK TASK1_ WHERE NAME=? "; SQL statement: delete from Employee cross join Task task1_ where name=? [42000-196] ... ERROR [support.hibernate.entity.TestHibernate] Query failure org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "DELETE FROM EMPLOYEE CROSS[*] JOIN TASK TASK1_ WHERE NAME=? "; SQL statement: delete from Employee cross join Task task1_ where name=? [42000-196] {code}
Verified in Hibernate 4 as well as the latest releases (5.2.17 / 5.3.0) |
|