[jboss-user] [EJB 3.0] - LazyInitializationException for detached entity collection b

soeren do-not-reply at jboss.com
Tue Feb 27 05:43:26 EST 2007


Hi,

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


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022968#4022968

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4022968



More information about the jboss-user mailing list