HQL-Insert with Select and Sub-Select fails
-------------------------------------------
Key: HHH-5274
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5274
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.2
Environment: Hibernate 3.5.2, Oracle 10 (using
org.hibernate.dialect.Oracle10gDialect)
Reporter: Björn Moritz
Attachments: Testcase.zip
In Hibernate 3.5.2 a HQL-Insert statement doing a select using a subselect is failing.
This is due to a wrong replacement of the table name in the generated SQL-Statement.
The following statement will work:
{code:sql}select a.id from A a where exists (select 1 from B b where b.id = a.id){code}
but an insert statement embedding the same statement does not work:
{code:sql}insert into C (id) select a.id from A a where exists (select 1 from B b where
b.id = a.id){code}
The latter statement will thrown an SqlSyntaxErrorException as the second 'a.id'
will get replaced with 'AAA.id' (which is the real table name and not the alias
used in the generated sql statement).
In Hibernate 3.1.3 both statements worked fine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira