-->
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: Query / Root classes not fetched
PostPosted: Thu Sep 22, 2005 5:23 am 
Regular
Regular

Joined: Tue Oct 07, 2003 1:13 pm
Posts: 70
Location: Paris, France
Hibernate version:3.1b2

Mapping documents:
<class name="BuyingOffer" table="buying_offer">
<id name="id" type="java.lang.Long" column="id" >
<generator class="sequence">
<param name="sequence">buying_offer_id_seq</param>
</generator>
</id>
<many-to-one name="file" column="file_id" class="File" not-null="true"/>
<set name="houses" table="houses_buying_offers" sort="natural">
<key column="offre_achat_id"/>
<many-to-many class="House" column="house_id"/>
</set>
<property name="name" type="string" length="30" not-null="true"/>
<many-to-one name="selling" column="selling_id" unique="true" class="Selling" cascade="all"/>
</class>

Code between sessionFactory.openSession() and session.close():
List<ReportItem> result = s.createQuery("select new "+ReportItemclass.getName()+"(oa,bi) from " +
"BuyingOffer as oa join fetch oa.houses as bi join fetch oa.selling as v join fetch oa.file as d join fetch d.person " +
"where v.dateReglement is null order by d.id").list();


The generated SQL (show_sql=true):

Every entity is fetched correctly except the BuyingOffer oa ! Hibernate hits the db afterwards to hydrate the BuyingOffers oa

Can someone give me any pointers to fetch *everything* in one unique select ?

Thank you a lot for your help
Richard


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.