-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Table-per-hierarchy polymorphic association
PostPosted: Wed Aug 03, 2005 2:26 pm 
Newbie

Joined: Mon Jun 27, 2005 11:33 am
Posts: 8
I have a polymorphic one-to-many association using table-per-hierarchy strategy. While it is working fine for persisting the association, I am unable to fetch an association of the base class.

Hibernate version: 3.0.5

Mapping documents:
Code:
    <class name="Coverage" table="elig_Cov" discriminator-value="0">
        <id name="id" column="elig_Cov_Id" type="java.lang.Long">
            <generator class="seqhilo">
                <param name="sequence">elig_Cov_Id_Sq</param>
                <param name="max_lo">10</param>
            </generator>
        </id>
        <discriminator column="CovStyle_Cd" type="integer"/>
        <property name="useServicePlan"
            column="UseSrvPlan" type="integer"/>
        <many-to-one name="subscription" column="elig_Sub_Id"
            cascade="save-update" lazy="false"/>
        <subclass name="ServiceTierCoverage" discriminator-value="1">
            <many-to-one name="servicePlan" column="csm_SrvPlan_Id"
                lazy="true" cascade="none"/>
            <bag name="serviceTierCoverageTs" inverse="true" lazy="false"
                outer-join="true" cascade="all-delete-orphan"                               
            collection-type="org.hibernate.usertype.PeriodOfExistenceType">
                <key column="elig_Cov_Id"/>
                <one-to-many class="ServiceTierCoverageT"/>
            </bag>
        </subclass>
        <subclass name="VendorTierCoverage" discriminator-value="2">
            <many-to-one name="vendorPlan" column="csm_VdrPlan_Id"
                cascade="none" lazy="false"/>
            <bag name="vendorTierCoverageTs"  inverse="true"
                lazy="false"  outer-join="true" cascade="all-delete-orphan"
                collection-type="org.hibernate.usertype.PeriodOfExistenceType">
                <key column="elig_Cov_Id"/>
                <one-to-many class="VendorTierCoverageT"/>
            </bag>
        </subclass>
  </class>


and the class with the association:
Code:
<class name="Subscription" table="elig_Sub">
    <!-- other properties snipped -->
    <set name="coverages" inverse="true" lazy="true" 
            cascade="all-delete-orphan">
            <key column="elig_Cov_Id"/>
            <one-to-many class="Coverage"/>
    </set>
</class>


Again, persistence is working fine, but calling subscription.getCoverages() returns an empty set. I'm even using "left join fetch sub.coverages" in my HQL and it is still not resolving this relationship properly.

Name and version of the database you are using: Oracle 10g

Debug level Hibernate log excerpt:
Unfortunately, I ran into a bug with logging that has not yet been fixed in 3.0.5, so I can not turn on debug logging.
http://opensource.atlassian.com/project ... se/HHH-547


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.