[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2593) Keyword UNION is prefixed with "this_." in filter conditions

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Oct 3 00:21:25 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28316 ] 

Steve Ebersole commented on HHH-2593:
-------------------------------------

Oddly enough, UNION is not always prefixed with the alias.  

I started with a simple UNION (sub)query as the filter condition and it worked fine.

The only way I could get this to occur given my test case was to add parens around the stuff right before the UNION (just like your's had).  In your query and mine, the parens are not required so there is an easy workaround...



> Keyword UNION is prefixed with "this_." in filter conditions
> ------------------------------------------------------------
>
>                 Key: HHH-2593
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2593
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.1
>         Environment: Oracle 10g: org.hibernate.dialect.OracleDialect
> Suse Linux
> Hibernate: 3.2.1.ga
> Hibernate Annotations: 3.2.1.GA
>            Reporter: Frederic Leitenberger
>            Assignee: Steve Ebersole
>            Priority: Trivial
>             Fix For: 3.2.6, 3.3
>
>
> I need to use a UNION-Subquery in a Filter condition unless HHH-298 is solved.
> But anyway, when using the keyword "union" in the Filter condition it is prefixed with "this_.".
> For instance, this ...
> @Filter(name = "resellerFilter", condition = "(select cu.resellerId from Customer cu, GeoNumber gn where (cu.id = gn.customerId and gn.id = this_.geoNumberId) UNION select cu.resellerId  from Customer cu where cu.detemeTemplateId = this_.id) in (null, :resellerIds)")
> ... produces this ...
> select
> ...
> from
>         DeTeMe this_ 
>     where
>         (
>             select
>                 cu.resellerId 
>             from
>                 Customer cu,
>                 GeoNumber gn 
>             where
>                 (
>                     cu.id = gn.customerId 
>                     and gn.id = this_.geoNumberId
>                 ) this_.UNION select
>                     cu.resellerId  
>                 from
>                     Customer cu 
>                 where
>                     cu.detemeTemplateId = this_.id
>             ) in (
>                 null, ?
>             ) 
>             and this_.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