[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5274) HQL-Insert with Select and Sub-Select fails

Björn Moritz (JIRA) noreply at atlassian.com
Thu Sep 16 05:18:24 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38418#action_38418 ] 

Björn Moritz commented on HHH-5274:
-----------------------------------

The problem still exists with both Hibernate 3.5.6 and Hibernate 3.6.0CR1

> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list