[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1901) Filtering on superclass property problem

Calin Pavel (JIRA) noreply at atlassian.com
Tue Jun 5 03:47:04 EDT 2007


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

Calin Pavel commented on HHH-1901:
----------------------------------

Just to know: the same behavior can be found in case you want to apply a filter to a set/list/bag that contains simillar structures (superclass-subclass). 

> Filtering on superclass property problem
> ----------------------------------------
>
>                 Key: HHH-1901
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1901
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.1.3
>         Environment: Hibernate 3.1.3  on Oracle 9i
>            Reporter: Juan Ignacio Cidre
>         Attachments: test.tar.gz
>
>
> I have three classes Order, Advertisements and Creatives.
> Advertisements is subclass of Creatives
> Order has a one-to-many to Advertisements
> That one-to-many has a filter. The condition has to do with a property of Creative, the Advertisements superclass.
> This is the Order to Advertisements mapping with a filter on deletionStatusId that is a field of Creative.
>         <set name="ads" inverse="true" lazy="true">
>             <key column="orderId"/>
>             <one-to-many class="com.inceptor.domain.msn.Advertisement"/>
>             <filter name="deletionStatusFilter" condition="deletionStatusId = 0"/>
>         </set>       
> This is the Creative mapping with the deletionStatusId, which is mapped as a component. It is a Enum in Java.
>            <component name="deletionStatus" 
> class="com.inceptor.domain.core.DeletionStatusType">
>                <property name="number" column="deletionStatusId" />
>            </component>
> I would expected an sql that appends a where condition like [superclass (Creative) table alias].deletionStatusId  instead I received [subclass (Advertisements) table alias].deletionStatusId
> This generates a DB error.
> Follows the generated query
> Note ads0_ instead of ads0_1_ 
> select ads0_.orderId as orderId1_, ads0_.id as id1_, ads0_.id as ID324_0_, ads0_1_.version as version324_0_, ads0_1_.searchEngineAccountId as searchEn3_324_0_, ads0_1_.creationTime as creation4_324_0_, ads0_1_.creatorId as creatorId324_0_, ads0_1_.modificationTime as modifica6_324_0_, ads0_1_.synchTime as synchTime324_0_, ads0_1_.modifierId as modifierId324_0_, ads0_1_.deletionStatusId as deletion9_324_0_, ads0_1_.deleterId as deleterId324_0_, ads0_1_.pushError as pushError324_0_, ads0_.seId as seId418_0_, ads0_.title as title418_0_, ads0_.description as descript4_418_0_, ads0_.displayURL as displayURL418_0_, ads0_.destinationURL as destinat6_418_0_, ads0_.originalDestinationURL as original7_418_0_, ads0_.orderId as orderId418_0_ from MSN_Advertisements ads0_ inner join GTK_Creatives ads0_1_ on ads0_.id=ads0_1_.ID where  ads0_.deletionStatusId = 0 and ads0_.orderId=?

-- 
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