0 Replies Latest reply on Oct 25, 2005 9:57 AM by martinganserer

    Lazy load

    martinganserer

      Hello,

      I have got a problem with lazy load. I have a test web application. In a very simple servlet I want to search for all objects of a specific EJB via the local interface:

      Here are my entity bean snippets:

      @OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
       @JoinColumn(name="forecast",referencedColumnName="id")
       public Collection<SalesForecast> getSalesForecasts()
       {
       return salesForecasts;
       }
      
      


      the reverse side:
      /**
       * @return the forecast.
       */
       @ManyToOne(fetch=FetchType.LAZY,optional=false)
       @JoinColumn(name="forecast",referencedColumnName="id")
       public Forecast getForecast()
       {
       return forecast;
       }
      



      Forecast forecast : forecastManager.getAllForecasts()
      


      If I take a look at my console I see the Hibernate SQL statements. These statements are telling me that the app fetches all data even the items that are marked for lazy load!