4 Replies Latest reply on Aug 22, 2007 11:51 AM by Ignacio de Cordoba

    Complex query generated by 4 non-lazy relations

    Ignacio de Cordoba Novice

      Hi there,
      i have a typical Portal-user-role-component structure, with obvious relations. I have to configure these relations as eager because I need to use entities in the client side (JSP page). My problem is that a very complex and slow query is generated with thousand "combinations" of results, just to load a portal. I've seen that changing eager to lazy in the relations makes the query be much simpler, as lazy relations are not loaded.
      Can I configure Hibernate / JBoss EJB3 to avoid this complex query. Login procedure takes about 20 seconds because of this overhead.
      thanks for any help.

      select portal0_.id as id347_5_, portal0_.locale as locale347_5_, portal0_.description as descript3_347_5_, portal0_.requiresSignupConfirmation as requires4_347_5_, portal0_.newUserNotification as newUserN5_347_5_, portal0_.sessionRememberDays as sessionR6_347_5_, portal0_.userSelfSignup as userSelf7_347_5_, portal0_.homeurl as homeurl347_5_, portal0_.lastAccessed as lastAcce9_347_5_, properties1_.portal_id as portal4_7_, properties1_.pkey as pkey7_, properties1_.pkey as pkey348_0_, properties1_.name as name348_0_, properties1_.value as value348_0_, properties1_.portal_id as portal4_348_0_, actions2_.Portal_id as Portal1_8_, component3_.className as actions2_8_, component3_.className as className346_1_, component3_.admin as admin346_1_, component3_.guest as guest346_1_, roles4_.portal_id as portal6_9_, roles4_.pkey as pkey9_, roles4_.pkey as pkey353_2_, roles4_.name as name353_2_, roles4_.description as descript3_353_2_, roles4_.portal_id as portal6_353_2_, roles4_.loginText as loginText353_2_, roles4_.newUserRole as newUserR5_353_2_, actions5_.Role_pkey as Role1_10_, component6_.className as actions2_10_, component6_.className as className346_3_, component6_.admin as admin346_3_, component6_.guest as guest346_3_, extrauserd7_.portal_id as portal7_11_, extrauserd7_.pkey as pkey11_, extrauserd7_.pkey as pkey352_4_, extrauserd7_.name as name352_4_, extrauserd7_.defaultValue as defaultV3_352_4_, extrauserd7_.options as options352_4_, extrauserd7_.required as required352_4_, extrauserd7_.portal_id as portal7_352_4_, extrauserd7_.publicField as publicFi6_352_4_ from Portal portal0_ left outer join Property properties1_ on portal0_.id=properties1_.portal_id left outer join Portal_Component actions2_ on portal0_.id=actions2_.Portal_id left outer join Component component3_ on actions2_.actions_className=component3_.className left outer join Role roles4_ on portal0_.id=roles4_.portal_id left outer join Role_Component actions5_ on roles4_.pkey=actions5_.Role_pkey left outer join Component component6_ on actions5_.actions_className=component6_.className left outer join ExtraUserdataField extrauserd7_ on portal0_.id=extrauserd7_.portal_id where portal0_.id=?