[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5291) Hibernate generates several join clauses for same table
Igor Nikolaev (JIRA)
noreply at atlassian.com
Tue Jun 15 05:49:02 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37457#action_37457 ]
Igor Nikolaev commented on HHH-5291:
------------------------------------
You're right, it should be ID
> Hibernate generates several join clauses for same table
> -------------------------------------------------------
>
> Key: HHH-5291
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5291
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.2
> Environment: Hibernate 3.5.2
> Reporter: Igor Nikolaev
>
> Suppose you've got a mapping:
> <class name="Class" table="TABLE1" dynamic-update="true">
> <id name="id" type="int">
> <column name="ID" />
> <generator class="assigned" />
> </id>
>
> <discriminator column="CLASS_TYPE"/>
> <property name="property1" type="string" column="PROPERTY1" update="false" insert="false"/>
>
> <join table="TABLE2" optional="true">
> <key column="ID" not-null="false"/>
> <property name="property2" column="PROPERTY2"/>
> </join>
>
> <subclass name="Subclass" discriminator-value="SUBCLASS">
> <join table="TABLE2">
> <key column="swift_id"/>
> <property name="property3" column="PROPERTY3"/>
> </join>
> </subclass>
> </class>
> As you can notice, we join the same table in subclass.
> Expected result is that Hibernat generates a query like this one:
> select
> this_.ID,
> this_.PROPERTY1,
> this_1_.PROPERTY2,
> this_1_.PROPERTY3
> from
> TABLE1 this_
> left inner join
> TABLE2 this_1_
> on this_.ID=this_1_.ID
> Instead, Hibernate joins TABLE2 twice and generates the following query:
> select
> this_.ID,
> this_.PROPERTY1,
> this_1_.PROPERTY2,
> this_2_.PROPERTY3
> from
> TABLE1 this_
> left inner join
> TABLE2 this_1_
> on this_.ID=this_1_.ID
> left outer join
> TABLE2 this_2_
> on this_.ID=this_2_.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