yeah you should realize that lazy=false for one-to-many, means a join with the one-to-many table i guess it isn't what you expect correct me if i'm wrong, but when you wrote lazy=false in the one-to-many element, you wanted the one-to-many collection fetched for every query, but with a seperate select and not a join didn't you? if this is what you wanted, you should just initiate the collection after the query with nhibernateutils.initilize
On Fri, Apr 16, 2010 at 3:28 PM, E-Bat <[email protected]> wrote: > hi nadav, i dont think i follow you, when you said "fetch mode select" > yopu meant to do it in the hbm? > > On 15 abr, 16:09, nadav s <[email protected]> wrote: > > when you put lazy=false it means a join > > for one-to-many, just put fetch mode select or lazy=true. > > if you want it initilized after a query, use NHibernateUtils.Initilize, > and > > it will execute another select for the one to manyOn Thu, Apr 15, 2010 at > 9:44 PM, E-Bat <[email protected]> wrote: > > > Hi, i have the following mapping file: > > > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > > > assembly="Compras.Core" namespace="Compras.Core.Domain"> > > > <class name="PurchaseOrder" table="Orkrg" lazy="false"> > > > <id name="Number" type="System.String" column="OrderNr"> > > > <generator class="assigned"/> > > > </id> > > > <many-to-one name="Supplier" class="Supplier" column="crdnr" > > > lazy="proxy"></many-to-one> > > > <bag name="TextOrderLines" table="orstx" inverse="true" > > > lazy="false" > > > access="field.camelcase-underscore" cascade="all-delete-orphan" > > > > > <key column="ordernr" /> > > > <one-to-many class="TextOrderLine"/> > > > </bag> > > > </class> > > > > > The problem is that i am getting server time out almost always, the > > > sql generated was something like the following, there i see to many > > > LEFT JOIN, i expected that the only join was for the parent > > > PurchaseOrder. This query run slow in the QAnalizer too. > > > Someone can point me out what i am doing wrong? > > > Thanks > > > > > SELECT > > > textorderl0_.ordernr as ordernr4_, > > > textorderl0_.ID as ID4_, textorderl0_.ID as ID3_3_, > > > textorderl0_.OrderNr as OrderNr3_3_, textorderl0_.regel as regel3_3_, > > > textorderl0_.tekst as tekst3_3_, > > > textorderl0_.reknr as reknr3_3_, textorderl0_.lev_crdnr as lev6_3_3_, > > > textorderl0_.TextDescription as TextDesc7_3_3_, > > > textorderl0_.Division as Division3_3_, textorderl0_.syscreated as > > > syscreated3_3_, > > > textorderl0_.syscreator as syscreator3_3_, > > > textorderl0_.sysmodified as sysmodi11_3_3_, textorderl0_.sysmodifier > > > as sysmodi12_3_3_, > > > textorderl0_.sysguid as sysguid3_3_, purchaseor1_.OrderNr as > > > OrderNr11_0_, > > > purchaseor1_.crdnr as crdnr11_0_, purchaseor1_.ord_contactperson as > > > ord3_11_0_, > > > purchaseor1_.ord_contactemail as ord4_11_0_, purchaseor1_.ord_predcode > > > as ord5_11_0_, > > > purchaseor1_.ord_cnt_job_desc as ord6_11_0_, purchaseor1_.debnr as > > > debnr11_0_, purchaseor1_.fakdebnr as fakdebnr11_0_, > > > purchaseor1_.verzdebnr as verzdebnr11_0_, purchaseor1_.einddebnr as > > > einddebnr11_0_, > > > purchaseor1_.refer as refer11_0_, purchaseor1_.refer1 as > > > refer12_11_0_, purchaseor1_.refer2 as refer13_11_0_, > > > purchaseor1_.refer3 as refer14_11_0_, purchaseor1_.orddat as > > > orddat11_0_, purchaseor1_.afldat as afldat11_0_, > > > purchaseor1_.afl_week as afl17_11_0_, purchaseor1_.ordbv_afdr as > > > ordbv18_11_0_, > > > purchaseor1_.magcode as magcode11_0_, > > > purchaseor1_.selcode as selcode11_0_, purchaseor1_.ex_artcode as > > > ex21_11_0_, > > > purchaseor1_.kstplcode as kstplcode11_0_, > > > purchaseor1_.routecode as routecode11_0_, purchaseor1_.ord_soort as > > > ord24_11_0_, > > > purchaseor1_.fiattering as fiattering11_0_, > > > purchaseor1_.ordbv_afgd as ordbv26_11_0_, purchaseor1_.afgehandld as > > > afgehandld11_0_, > > > purchaseor1_.nettoprijs as nettoprijs11_0_, purchaseor1_.inv_in_vv as > > > inv29_11_0_, > > > purchaseor1_.valcode as valcode11_0_, purchaseor1_.koers as > > > koers11_0_, purchaseor1_.betcond as betcond11_0_, > > > purchaseor1_.levwijze as levwijze11_0_, purchaseor1_.pakbon_afg as > > > pakbon34_11_0_, > > > purchaseor1_.paklst_afg as paklst35_11_0_, purchaseor1_.colli as > > > colli11_0_, purchaseor1_.bruto_gew as bruto37_11_0_, > > > purchaseor1_.netto_gew as netto38_11_0_, purchaseor1_.tot_bdr as > > > tot39_11_0_, purchaseor1_.user_id as user40_11_0_, > > > purchaseor1_.betaald as betaald11_0_, purchaseor1_.faknr as > > > faknr11_0_, purchaseor1_.pakbon_nr as pakbon43_11_0_, > > > purchaseor1_.pakbon_dat as pakbon44_11_0_, > > > purchaseor1_.status as status11_0_, purchaseor1_.offerte_nr as > > > offerte46_11_0_, purchaseor1_.iso_taalcd as iso47_11_0_, > > > purchaseor1_.iso_taalcd_f as iso48_11_0_, purchaseor1_.fakt_code as > > > fakt49_11_0_, > > > purchaseor1_.represent_id as represent50_11_0_, purchaseor1_.eca_type > > > as eca51_11_0_, purchaseor1_.cntr_id as cntr52_11_0_, > > > purchaseor1_.int_vrw as int53_11_0_, purchaseor1_.represent_id2 as > > > represent54_11_0_, > > > purchaseor1_.represent_ideca as represent55_11_0_, > > > purchaseor1_.calc_incl_vat as calc56_11_0_, > > > purchaseor1_.fakcrdnr as fakcrdnr11_0_, purchaseor1_.bdr_disc_val as > > > bdr58_11_0_, purchaseor1_.bdr_val as bdr59_11_0_, > > > purchaseor1_.bstwijze as bstwijze11_0_, purchaseor1_.bdr_ev_val as > > > bdr61_11_0_, purchaseor1_.bdr_vat_val as bdr62_11_0_, > > > purchaseor1_.docnumber as docnumber11_0_, purchaseor1_.paymentmethod > > > as payment64_11_0_, > > > purchaseor1_.projectnr as projectnr11_0_, purchaseor1_.DocAttachmentID > > > as DocAtta66_11_0_, > > > purchaseor1_.ord_debtor_name as ord67_11_0_, > > > purchaseor1_.ord_AddressLine1 as ord68_11_0_, > > > purchaseor1_.ord_AddressLine2 as ord69_11_0_, > > > purchaseor1_.ord_AddressLine3 as ord70_11_0_, > > > purchaseor1_.ord_PostCode as ord71_11_0_, purchaseor1_.ord_City as > > > ord72_11_0_, > > > purchaseor1_.ord_StateCode as ord73_11_0_, > > > purchaseor1_.ord_landcode as ord74_11_0_, purchaseor1_.ord_Phone as > > > ord75_11_0_, > > > purchaseor1_.ord_Fax as ord76_11_0_, > > > purchaseor1_.ord_Initials as ord77_11_0_, purchaseor1_.del_debtor_name > > > as del78_11_0_, > > > purchaseor1_.del_AddressLine1 as del79_11_0_, > > > purchaseor1_.del_AddressLine2 as del80_11_0_, > > > purchaseor1_.del_AddressLine3 as del81_11_0_, > > > purchaseor1_.del_PostCode as del82_11_0_, > > > purchaseor1_.del_City as del83_11_0_, purchaseor1_.del_StateCode as > > > del84_11_0_, purchaseor1_.del_landcode as del85_11_0_, > > > purchaseor1_.del_Phone as del86_11_0_, purchaseor1_.del_Fax as > > > del87_11_0_, purchaseor1_.del_contactperson as del88_11_0_, > > > purchaseor1_.del_predcode as del89_11_0_, > > > purchaseor1_.del_cnt_job_desc as del90_11_0_, > > > purchaseor1_.del_Initials as del91_11_0_, purchaseor1_.inv_debtor_name > > > as inv92_11_0_, > > > purchaseor1_.inv_AddressLine1 as inv93_11_0_, > > > purchaseor1_.inv_AddressLine2 as inv94_11_0_, > > > purchaseor1_.inv_AddressLine3 as inv95_11_0_, > > > purchaseor1_.inv_PostCode as inv96_11_0_, purchaseor1_.inv_City as > > > inv97_11_0_, purchaseor1_.inv_StateCode as inv98_11_0_, > > > purchaseor1_.inv_landcode as inv99_11_0_, > > > purchaseor1_.inv_Phone as inv100_11_0_, purchaseor1_.inv_Fax as > > > inv101_11_0_, > > > purchaseor1_.inv_contactperson as inv102_11_0_, > > > purchaseor1_.inv_predcode as inv103_11_0_, > > > purchaseor1_.inv_cnt_job_desc as inv104_11_0_, > > > purchaseor1_.inv_Initials as inv105_11_0_, > > > purchaseor1_.Approver as Approver11_0_, purchaseor1_.Approved as > > > Approved11_0_, purchaseor1_.DocumentID as DocumentID11_0_, > > > purchaseor1_.resulttype as resulttype11_0_, > > > purchaseor1_.ServiceCall_ID as Servic110_11_0_, > > > purchaseor1_.invoice_method as invoice111_11_0_, > > > purchaseor1_.del_contactemail as del112_11_0_, > > > purchaseor1_.inv_contactemail as inv113_11_0_, purchaseor1_.freefield1 > > > as freefield114_11_0_, > > > purchaseor1_.freefield2 as freefield115_11_0_, purchaseor1_.freefield3 > > > as freefield116_11_0_, > > > purchaseor1_.freefield4 as freefield117_11_0_, purchaseor1_.freefield5 > > > as freefield118_11_0_, > > > purchaseor1_.Picked as Picked11_0_, purchaseor1_.Division as > > > Division11_0_, purchaseor1_.ImATD as ImATD11_0_, > > > purchaseor1_.ImETA as ImETA11_0_, purchaseor1_.ImATA as ImATA11_0_, > > > purchaseor1_.syscreated as syscreated11_0_, > > > purchaseor1_.syscreator as syscreator11_0_, > > > purchaseor1_.sysmodified as sysmod126_11_0_, purchaseor1_.sysmodifier > > > as sysmod127_11_0_, > > > purchaseor1_.sysguid as sysguid11_0_, purchaseor1_.ApplyLinkItem as > > > ApplyL129_11_0_, supplier2_.crdnr as crdnr5_1_, > > > supplier2_.cnt_id as cnt2_5_1_, supplier2_.cmp_name as cmp3_5_1_, > > > supplier2_.cmp_fadd1 as cmp4_5_1_, > > > supplier2_.cmp_fadd2 as cmp5_5_1_, supplier2_.cmp_fadd3 as cmp6_5_1_, > > > supplier2_.cmp_fpc as cmp7_5_1_, supplier2_.cmp_fcity as cmp8_5_1_, > > > supplier2_.currency as currency5_1_, supplier2_.cmp_wwn as cmp10_5_1_, > > > contact3_.cnt_Id as cnt1_8_2_, contact3_.FullName as FullName8_2_, > > > contact3_.cnt_email as cnt3_8_2_, contact3_.predcode as predcode8_2_, > > > contact3_.cnt_job_desc as cnt5_8_2_ > > > FROM orstx textorderl0_ > > > left outer join Orkrg purchaseor1_ on > > > textorderl0_.OrderNr=purchaseor1_.OrderNr > > > left outer join cicmpy supplier2_ on > > > purchaseor1_.crdnr=supplier2_.crdnr > > > left outer join cicntp contact3_ on supplier2_.cnt_id=contact3_.cnt_Id > > > WHERE textorderl0_.ordernr=10055501 > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "nhusers" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
