[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1652) Missing join clause on generated SQL for a select of a subclass property
Steve Ebersole (JIRA)
noreply at atlassian.com
Thu Nov 16 11:06:04 EST 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1652?page=all ]
Steve Ebersole closed HHH-1652:
-------------------------------
Resolution: Duplicate
> Missing join clause on generated SQL for a select of a subclass property
> ------------------------------------------------------------------------
>
> Key: HHH-1652
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1652
> Project: Hibernate3
> Type: Bug
> Components: query-sql
> Versions: 3.2.0.cr2, 3.1.3, 3.2.0 cr1
> Environment: Hibernate 3.2 from SVN, MS SQL Server 2005
> Reporter: William Monti
> Attachments: MissingJoinClause.zip
>
>
> Hibernate isn't generating the join clause of a subclass when I try to select a subclass property.
> Class hierarchy:
> @Entity
> @Inheritance(strategy = InheritanceType.JOINED)
> public class A
> {
> private String a;
> }
> @Entity
> public class B extends A
> {
> private String b;
> }
> With the following HQL it generates a SQL with a unknown alias name "a0_1_":
> HQL: SELECT a.b FROM com.nm.test.A a
> SQL: select a0_1_.b as col_0_0_ from A a0_
> What raises the error:
> ERROR JDBCExceptionReporter:72 - The multi-part identifier "a0_1_.b" could not be bound.
> Looks like it is generating the alias for the select clause, but it isn't creating the alias on the from clause.
> If I add the full object a to the select clause, it works (but it is just a workaround since it will degrade performance):
> HQL: SELECT a, a.b FROM com.nm.test.A a
> SQL: select a0_.id as col_0_0_, a0_1_.b as col_1_0_, a0_.id as id0_, a0_.a as a0_, a0_1_.b as b1_, case when a0_1_.id is not null then 1 when a0_.id is not null then 0 end as clazz_ from A a0_ left outer join B a0_1_ on a0_.id=a0_1_.id
--
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