From: <leg...@at...> - 2003-06-27 09:40:10
|
The following comment has been added to this issue: Author: Sander Verbruggen Created: Fri, 27 Jun 2003 3:48 AM Body: It seems that this works fine when a property of the second joined-subclass is used in the query. If my query only contains where procureur.jurist.persoon.naam = ? Hibernate fails, but if my query contains where procureur.jurist.einddatum = ? and procureur.jurist.persoon.naam = ? then everything is fine. It seems that the parser interpretes the path-expression incorrectly if too many entities are used... --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-151 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-151 Summary: Traversing several joined-subclasses in where clause leaves out inner joins for superclasses Type: Bug Status: Unassigned Priority: Critical Project: Hibernate2 Components: core Versions: 2.0.1 Assignee: Reporter: Sander Verbruggen Created: Thu, 26 Jun 2003 3:05 AM Updated: Thu, 26 Jun 2003 3:05 AM Environment: WSAD 5.0.1, JDK 1.3.1, Oracle 9i, Windows 2000 Description: Class-diagram: a-->b a inherits from b a==b a has relationship to b (Sorry, classnames are in Dutch) Persoon == Beroepsuitoefening Beroepsuitoefening <-- Jurist Jurist == Bevoegdheid Bevoegdheid <-- Beediging <-- Procureurschap If my query contains 'where jurist.persoon.naam like ?', the generated SQL looks like this (which is OK): select count(*) as x0_0_ from jurist persiste0_ inner join beroepsuitoefening persiste0__1 on persiste0_.beg_id=persiste0__1.id, persoon persiste1_ where ( ( persiste1_.naam like ? and persiste0__1.psn_id=persiste1_.id ) ) However, if I start one level deeper in the hierarchy ('where procureurschap.jurist.persoon.naam like ?') the SQL query looks like this: select count(*) as x0_0_ from procureurschap persiste0_ inner join beediging persiste0__1 on persiste0_.bvh_id=persiste0__1.bvh_id inner join bevoegdheid persiste0__2 on persiste0_.bvh_id=persiste0__2.id, jurist persiste1_, persoon persiste2_ where ( ( persiste2_.naam=? and persiste0__2.beg_id=persiste1_.beg_id and persiste1__1.psn_id=persiste2_.id ) ) [Queries are indented to show outline] As you can see, the last clause references persiste1__1, which isn't listed in the from clause. It's intended to, because the pattern matches with the previous example (_1 begin the first innerjoin for persiste1_). It should be an alias for beroepsuitoefening just as it is in the previous example. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |