-->
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.  [ 2 posts ] 
Author Message
 Post subject: Global loading - join not lazy
PostPosted: Thu Feb 15, 2007 1:07 pm 
Beginner
Beginner

Joined: Wed Aug 31, 2005 3:54 am
Posts: 45
Hello everyboy.
I have a question on optimized loading on Hinernate 3.2.1 .
I make the following mapping [see (1)] and try to load a graph in only one select.
So i create all my beans [see (2)] and in an other session try to get only Demande [see (3)].
In fact, i don't obtain one select but two [see (3)].

Is there any reason why Hibernate can't do that in one select ?
Thanks

----------------------------------------------------------------------------------------------------------------------
(1)
<!-- per-concrete-class -->
<class name="Demande" table="A_DEM">
<id name="id">
<generator class="hilo"/>
</id>
<property name="m_demandeOrigine" column="DDE_ORIGINE"/>
<many-to-one
name="m_dossierAffectationReprise"
class="DossierAffectation"
column="DOSSIER_ID"
unique="true"
fetch="join"
cascade="all"/>
</class>

<!-- per-concrete-class -->
<class name="DossierAffectation" table="A_DAFFABS" lazy="false">
<id name="id">
<generator class="hilo"/>
</id>
<property name="m_demande" column="M_DEMANDE"/>
<union-subclass name="DossierAAffecter" table="A_DOSSAAFF">
</union-subclass>
<union-subclass name="DossierAffecte" table="A_DOSSAFF">
<!-- one-to-one name="m_dossierExamen" class="DossierExamen" fetch="join"/ -->
<many-to-one
name="m_dossierExamen"
class="DossierExamen"
column="DOSSEXA_ID"
unique="true"
fetch="join"
cascade="all"/>
</union-subclass>
</class>

<!-- per-hierarchy -->
<class name="DossierExamen" table="A_DEXAM" lazy="false">
<id name="id">
<generator class="hilo"/>
</id>
<discriminator column="TYPE_CLASS" type="string"/>
<subclass name="Examen" discriminator-value="0505">
</subclass>
<subclass name="Decision" discriminator-value="0507">
<property name="m_validee" column="EST_VALIDEE"/>
</subclass>
</class>

----------------------------------------------------------------------------------------------------------------------
(2)
Demande lDemande = new Demande();
lDemande.setM_demandeOrigine("lDemande");
DossierAffecte lDossierAffecte = new DossierAffecte();
lDossierAffecte.setM_demande("lDossierAffecte");
lDemande.setM_dossierAffectationReprise(lDossierAffecte);
Decision lDecision = new Decision();
lDecision.setM_validee("lDecision");
lDossierAffecte.setM_dossierExamen(lDecision);
s.persist(lDemande);

----------------------------------------------------------------------------------------------------------------------
(3)
Demande lDemande2 = (Demande) s.get(Demande.class, this.idDemande);

----------------------------------------------------------------------------------------------------------------------
(4)

--->select
demande0_.id as id0_1_,
demande0_.DDE_ORIGINE as DDE2_0_1_,
demande0_.DOSSIER_ID as DOSSIER3_0_1_,
dossieraff1_.id as id1_0_,
dossieraff1_.M_DEMANDE as M2_1_0_,
dossieraff1_.DOSSEXA_ID as DOSSEXA1_3_0_,
dossieraff1_.clazz_ as clazz_0_
from
A_DEM demande0_
left outer join
(
select
M_DEMANDE,
null as DOSSEXA_ID,
id,
0 as clazz_
from
A_DAFFABS
union
select
M_DEMANDE,
null as DOSSEXA_ID,
id,
1 as clazz_
from
A_DOSSAAFF
union
select
M_DEMANDE,
DOSSEXA_ID,
id,
2 as clazz_
from
A_DOSSAFF
) dossieraff1_
on demande0_.DOSSIER_ID=dossieraff1_.id
where
demande0_.id=?



--->select
dossierexa0_.id as id4_0_,
dossierexa0_.EST_VALIDEE as EST3_4_0_,
dossierexa0_.TYPE_CLASS as TYPE2_4_0_
from
A_DEXAM dossierexa0_
where
dossierexa0_.id=?


Top
 Profile  
 
 Post subject: Resolved
PostPosted: Fri Feb 16, 2007 4:30 am 
Beginner
Beginner

Joined: Wed Aug 31, 2005 3:54 am
Posts: 45
I found the property MAX_FETCH_DEPTH and it resolved my problem.
Thanks to me ;-)

Bye


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.