0 Replies Latest reply on Feb 27, 2007 5:43 AM by Soeren Gerlach

    LazyInitializationException for detached entity collection b

    Soeren Gerlach Newbie


      I have two entities with a simple OneToMany relationship mapping. The parent ("VolaConfigList") contains a simple collection of childs ("List"), which I have defined as this:

       @Basic(fetch = FetchType.EAGER)
       @OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
       @JoinColumn(name = "vcd_vcl_id")
       public List<VolaConfigDetail> getDetailList() {
       return detailList;

      When I use the parent object as detached object I get a org.hibernate.LazyInitializationException when trying to access the list of childs. This makes me wonder, because the EAGER type should fetch the collection upon retrieving the parent object already?
      In any cirumstances I must use this object detached, so I'm looking for a way to handle this problem with EJB instruments.

      Thanks & regards
      Soeren Gerlach