[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7314) DELETE Query generating invalid SQL for PostgreSQL databases.
Bryan Varner (JIRA)
noreply at atlassian.com
Thu May 10 10:26:11 EDT 2012
DELETE Query generating invalid SQL for PostgreSQL databases.
-------------------------------------------------------------
Key: HHH-7314
URL: https://hibernate.onjira.com/browse/HHH-7314
Project: Hibernate ORM
Issue Type: Bug
Components: core, entity-manager
Affects Versions: 4.1.3, 4.1.2
Environment: Hibernate 4.1.2, 4.1.3, PostgreSQL 9.1 (should effect all releases from 8.1 ~ current)
Reporter: Bryan Varner
Using a JPA Delete query with conditions requiring a join through Hibernate entity-manager generates invalid SQL for PostgreSQL.
PostgreSQL cannot use CROSS JOIN in the FROM clause of a DELETE query.
For example: JPQL Query
{code}
DELETE FROM Foo f WHERE f.bar.key = :key AND f.anotherprop = :anotherval
{code}
Generates an (invalid) SQL query like:
{code}
delete from schema.Foo cross join schema.Bar bar1_ where key=$1 and anotherprop=$2
{code}
For PostgreSQL I believe this needs to look like:
{code}
delete from schema.Foo using schema.Bar bar1_ where key=$1 and anotherprop=$2
{code}
PostgreSQL documentation on the DELETE syntax:
http://www.postgresql.org/docs/8.1/static/sql-delete.html
http://www.postgresql.org/docs/9.1/static/sql-delete.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list