-->
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.  [ 3 posts ] 
Author Message
 Post subject: single point polymorphic association fetching
PostPosted: Fri Dec 31, 2004 9:14 am 
Newbie

Joined: Fri Dec 31, 2004 8:42 am
Posts: 3
When using <any> for a single point polymorphic association, how can I efficiently retrieve the associated entities?

e.g.
Code:
  <class name="Foo">
        ...
        <property name="deptId"/>
        <any name="bar" meta-type="string" id-type="Integer">
            <meta-value value="bartype1" class="Bar1"/>           
            <meta-value value="bartype2" class="Bar2"/>           
            <column name="TYPE"/>
            <column name="ID"/>
        </any>
       
    </class>


If I run the query "from Foo where deptId = 3" and 100 Foos are returned, is it possible to retrieve the Bars in the same query (outer-join) or in subsequent queries using batch fetching. "left join fetch bar" does not work, nor does setting batch-size in "bartypeX"



Thanks,
J.

(Hibernate version 2.1.7)[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 01, 2005 2:11 pm 
Newbie

Joined: Fri Dec 31, 2004 8:42 am
Posts: 3
Whatever happened to the <join table="bars" outer-join="false"> as mentioned in Gavin's blog
http://blog.hibernate.org/cgi-bin/blosx ... /join.html

J.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 4:50 am 
Newbie

Joined: Fri Dec 31, 2004 8:42 am
Posts: 3
I figured my original problem out, if I set

<class name="Bar1" table="BAR1" lazy="true" batch-size="10">

and then, after loading the foo objects, explicitly hydrate the bar using foo.getBar().getSomeProperty(), the bar subclasses are loaded in batches. Without the lazy=true, the bar objects are loaded one by one.

J.


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

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.