1 Reply Latest reply on Jun 5, 2008 12:11 AM by sdplox

    Expensive lazy load case

    sdplox

      Hi,


      our team is having some perfomance issues related lazy loading on class properties.


      when we query for an object to entity manager, (searching a client for example) we need to Hibernate.initialize() a class property, that is a class too.


      therefore, the last class have more properties that must be initialized!!


      so make a simple search is chaining a tree of properties to initialize.


      what should you do in a case like this one?




      Thanks for reading.

        • 1. Re: Expensive lazy load case
          sdplox

          day along, we found a good option.


          is not tested yet, but we think that change this code lines:


          
          merchants = em.createQuery("select m from Merchant m where lower(m.merchantGeneralCompanyName) like :merchSearchPattern or lower(m.merchantComertialCompanyName) like :merchSearchPattern")
          
          ).setParameter("merchSearchPattern", getSearchPattern())
          
                            .setMaxResults(pageSize)
          
                            .setFirstResult( page * pageSize )
          
                            .getResultList();
          
          



          for something more specific in the first line can works, something like:


          
          merchants = em.createQuery("select m.generalCompanyName from Merchant m where lower
          
          



          for example.


          what do you think?