-->
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: Extra SQL obwohl schon im join
PostPosted: Wed Jul 19, 2006 10:30 am 
Newbie

Joined: Tue Aug 09, 2005 7:02 pm
Posts: 7
Ich habe eine <many-to-one> Beziehung und obwohl in dem SQL der 'einzelne' Eintrag schon per outer-join mit angesprochen wird, wird trotzdem noch einmal ein einzelner SQL abgeschickt.

Code:
15:26:17,973 DEBUG [SQL] select this_.bp_cd as bp1_5_, this_.bp_ods_cd as bp2_5_, this_.cat_it_cd as cat3_5_, this_.cust_nb as cust4_5_, this_.in_dt as in5_5_, this_.vers_cd as vers6_5_, this_.assort_no as assort7_38_5_, this_.bill_no as bill8_38_5_, this_.camp_dc as camp9_38_5_, this_.camp_nb as camp10_38_5_, this_.cat_it_bar_cd as cat11_38_5_, this_.conf_no as conf12_38_5_, this_.ctry_cd as ctry13_38_5_, this_.curr_cd as curr14_38_5_, this_.dwhs_st_cd as dwhs15_38_5_, this_.fax_conf_no as fax16_38_5_, this_.free_tx as free17_38_5_, this_.mod_no as mod18_38_5_, this_.mod_ty_cd as mod19_38_5_, this_.orig_cat_it_cd as orig20_38_5_, this_.q as q38_5_, this_.ret_rght_fl as ret22_38_5_, this_.sheet_addr_cd as sheet23_38_5_, this_.sheet_nb as sheet24_38_5_, this_.sheet_no as sheet25_38_5_, this_.src_cd as src26_38_5_, this_.src_cd_detl as src27_38_5_, this_.st_cd as st28_38_5_, this_.s_dt as s29_38_5_, this_.tenant as tenant38_5_, this_.tot_val as tot31_38_5_, this_.tx_ty_cd as tx32_38_5_, this_.c_uid as c33_38_5_, this_.c_dt as c34_38_5_, this_.u_uid as u35_38_5_, this_.u_dt as u36_38_5_, this_.susy_tx_cd as susy37_38_5_, this_.rec_stat as rec38_38_5_, this_.bp_cd as bp1_38_5_, this_.bp_ods_cd as bp2_38_5_, this_.cat_it_cd as cat3_38_5_, this_.vers_cd as vers6_38_5_, this_.cust_nb as cust4_38_5_, '002' as formula4_5_, catalogsea2_.cat_it_cd as cat1_0_, catalogsea2_.cat_ods_cd as cat2_0_, catalogsea2_.client_bp_cd as client3_0_, catalogsea2_.client_ods_cd as client4_0_, catalogsea2_.vers_cd as vers5_0_, catalogsea2_.cat_it_cd as cat1_8_0_, catalogsea2_.client_bp_cd as client3_8_0_, catalogsea2_.client_ods_cd as client4_8_0_, catalogsea2_.vers_cd as vers5_8_0_, catalogsea2_.alias_cat_it_cd as alias6_8_0_, catalogsea2_.cat_it_bar_cd as cat7_8_0_, catalogsea2_.cat_ty_cd as cat8_8_0_, catalogsea2_.cfg_cd as cfg12_8_0_, catalogsea2_.del_dt as del13_8_0_, catalogsea2_.grp1_cd as grp22_8_0_, catalogsea2_.grp1_ty_cd as grp23_8_0_, catalogsea2_.grp2_cd as grp24_8_0_, catalogsea2_.grp2_ty_cd as grp25_8_0_, catalogsea2_.grp3_cd as grp26_8_0_, catalogsea2_.grp3_ty_cd as grp27_8_0_, catalogsea2_.inact_fl as inact28_8_0_, catalogsea2_.main_part_nm as main37_8_0_, catalogsea2_.orig_cat_it_cd as orig42_8_0_, catalogsea2_.pric_cd as pric47_8_0_, catalogsea2_.rel_dt as rel49_8_0_, catalogsea2_.tit as tit8_0_, catalogsea2_.c_uid as c59_8_0_, catalogsea2_.c_dt as c60_8_0_, catalogsea2_.u_uid as u61_8_0_, catalogsea2_.u_dt as u62_8_0_, catalogsea2_.pd_cd as pd45_8_0_, (rtrim(catalogsea2_.client_bp_cd) + '/ODS') as formula0_0_, customerad3_.bp_cd as bp1_1_, customerad3_.bp_ods_cd as bp2_1_, customerad3_.cust_nb as cust3_1_, customerad3_.bp_cd as bp1_12_1_, customerad3_.bp_ods_cd as bp2_12_1_, customerad3_.cust_nb as cust3_12_1_, customerad3_.addr_ty_cd as addr4_12_1_, customerad3_.addr_nm as addr5_12_1_, customerad3_.bp_cust_nb as bp7_12_1_, customerad3_.city as city12_1_, customerad3_.cust_nm as cust11_12_1_, customerad3_.cust_ty_cd as cust13_12_1_, customerad3_.del_dt as del14_12_1_, customerad3_.inact_fl as inact15_12_1_, customerad3_.street as street12_1_, customerad3_.supplement1 as supplement23_12_1_, customerad3_.zip as zip12_1_, customerex4_.bp_cd as bp1_2_, customerex4_.bp_ods_cd as bp2_2_, customerex4_.cust_nb as cust3_2_, customerex4_.agcy_nb as agcy4_13_2_, customerex4_.allo_man_oe_fl as allo5_13_2_, customerex4_.bnk_acc_nb as bnk6_13_2_, customerex4_.bnk_id as bnk7_13_2_, customerex4_.bnk_nm as bnk8_13_2_, customerex4_.branch_nb as branch9_13_2_, customerex4_.chain_nb as chain10_13_2_, customerex4_.clust_nb as clust11_13_2_, customerex4_.csgn_fl as csgn12_13_2_, customerex4_.fax_cf_dt as fax13_13_2_, customerex4_.loc_nb as loc14_13_2_, customerex4_.pric_list as pric15_13_2_, customerex4_.stat_grp_1 as stat20_13_2_, customerex4_.stat_grp_2 as stat21_13_2_, customerex4_.stat_grp_3 as stat22_13_2_, customerex4_.stat_grp_4 as stat23_13_2_, customerex4_.stat_grp_5 as stat24_13_2_, customerex4_.c_uid as c27_13_2_, customerex4_.c_dt as c28_13_2_, customerex4_.u_uid as u29_13_2_, customerex4_.u_dt as u30_13_2_, customer5_.bp_cd as bp1_3_, customer5_.bp_ods_cd as bp2_3_, customer5_.cust_nb as cust3_3_, customer5_.actv_fl as actv4_34_3_, customer5_.cust_nm as cust5_34_3_, customer5_.dlvy_plnng as dlvy6_34_3_, customer5_.from_dt as from7_34_3_, customer5_.itvl as itvl34_3_, customer5_.max_ext_ava_q_dt as max9_34_3_, customer5_.max_s_dt as max10_34_3_, customer5_.min_q as min11_34_3_, customer5_.min_q_fri as min12_34_3_, customer5_.min_q_mon as min13_34_3_, customer5_.min_q_sat as min14_34_3_, customer5_.min_q_sun as min15_34_3_, customer5_.min_q_thu as min16_34_3_, customer5_.min_q_tue as min17_34_3_, customer5_.min_q_wed as min18_34_3_, customer5_.nb_cd_1 as nb19_34_3_, customer5_.nb_cd_2 as nb20_34_3_, customer5_.nb_cd_3 as nb21_34_3_, customer5_.nb_cd_4 as nb22_34_3_, customer5_.nb_cd_5 as nb23_34_3_, customer5_.c_uid as c24_34_3_, customer5_.c_dt as c25_34_3_, customer5_.u_uid as u26_34_3_, customer5_.u_dt as u27_34_3_, customer5_.susy_tx_cd as susy28_34_3_, customer5_.rec_stat as rec29_34_3_, customer5_.bp_cd as bp1_34_3_, customer5_.bp_ods_cd as bp2_34_3_, customer5_.cust_nb as cust3_34_3_, catalogpro6_.cat_it_cd as cat1_4_, catalogpro6_.vers_cd as vers2_4_, catalogpro6_.dv_fl as dv3_41_4_, catalogpro6_.dv_ty_cd as dv4_41_4_, catalogpro6_.elop_cd as elop5_41_4_, catalogpro6_.paym_term_cd as paym6_41_4_, catalogpro6_.sngl_units as sngl7_41_4_, catalogpro6_.unit_ppd_4 as unit8_41_4_, catalogpro6_.c_uid as c9_41_4_, catalogpro6_.c_dt as c10_41_4_, catalogpro6_.u_uid as u11_41_4_, catalogpro6_.u_dt as u12_41_4_, catalogpro6_.susy_tx_cd as susy13_41_4_, catalogpro6_.rec_stat as rec14_41_4_, catalogpro6_.repl_id as repl15_41_4_ from c_scn_s_v2 this_ left outer join c_cat_srch_v2 catalogsea2_ on this_.cat_it_cd=catalogsea2_.cat_it_cd and this_.bp_cd=catalogsea2_.client_bp_cd and this_.bp_ods_cd=catalogsea2_.client_ods_cd and this_.vers_cd=catalogsea2_.vers_cd left outer join c_bp_addr_s2 customerad3_ on this_.bp_cd=customerad3_.bp_cd and this_.bp_ods_cd=customerad3_.bp_ods_cd and this_.cust_nb=customerad3_.cust_nb and '002'=customerad3_.addr_ty_cd left outer join cz_c_bp_v2 customerex4_ on customerad3_.bp_cd=customerex4_.bp_cd and customerad3_.bp_ods_cd=customerex4_.bp_ods_cd and customerad3_.cust_nb=customerex4_.cust_nb left outer join c_cust_rim_v2 customer5_ on customerad3_.bp_cd=customer5_.bp_cd and customerad3_.bp_ods_cd=customer5_.bp_ods_cd and customerad3_.cust_nb=customer5_.cust_nb left outer join c_cat3_v2 catalogpro6_ on this_.cat_it_cd=catalogpro6_.cat_it_cd and this_.vers_cd=catalogpro6_.vers_cd where this_.bp_cd=? and this_.bp_ods_cd=? and this_.sheet_nb=? order by this_.cust_nb asc

15:26:18,143 DEBUG [SQL] select catalogpro0_.cat_it_cd as cat1_0_, catalogpro0_.vers_cd as vers2_0_, catalogpro0_.dv_fl as dv3_41_0_, catalogpro0_.dv_ty_cd as dv4_41_0_, catalogpro0_.elop_cd as elop5_41_0_, catalogpro0_.paym_term_cd as paym6_41_0_, catalogpro0_.sngl_units as sngl7_41_0_, catalogpro0_.unit_ppd_4 as unit8_41_0_, catalogpro0_.c_uid as c9_41_0_, catalogpro0_.c_dt as c10_41_0_, catalogpro0_.u_uid as u11_41_0_, catalogpro0_.u_dt as u12_41_0_, catalogpro0_.susy_tx_cd as susy13_41_0_, catalogpro0_.rec_stat as rec14_41_0_, catalogpro0_.repl_id as repl15_41_0_ from c_cat3_v2 catalogpro0_ where catalogpro0_.cat_it_cd=? and catalogpro0_.vers_cd=?


In dem Code sieht man, dass die Tabelle c_cat3_v2 im ersten SQL über einen left outer join mit angesprochen wird und im zweiten SQL wird die entsprechende Zeile noch einmal geholt.

Kann ich das unterbinden bzw. woran liegt das.

Danke.


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.