[jboss-user] [EJB 3.0] - Failed to lazily initialize a collection of role

dmitryak do-not-reply at jboss.com
Wed Jan 10 05:51:33 EST 2007


Hi...

I don't speak English very well, so I apologise for that.

I have a problem. 
I have made Entity Bean with collection field:


  | @Entity
  | public class DocumentEntity implements Serializable {
  | 
  | 	private static final long serialVersionUID = 4842258583854141368L;
  | 
  | 	private int id;
  | 
  | 	private List<DocCategoryEntity> docCategories;
  | 
  | 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  | 	public List<DocCategoryEntity> getDocCategories() {
  | 		return docCategories;
  | 	}
  | 
  | 	public void setDocCategories(List<DocCategoryEntity> categories) {
  | 		this.docCategories = categories;
  | 	}
  | ...
  | }
  | 

I deployed it on JBoss 4.0.4GA + EJB 3.0 RC8 FD.

After that I made a junit which read a list of DocumentEntity-s (of course, I coded and deployd session bean which provide requered operations).

And my problem is: when I try to read docCategories field of any item of result list I get an exception "org.hibernate.LazyInitializationException"

But as you can see in my entity class source I am not using lazy loading (FetchType.EAGER). What did I make wrong???


Help, PLEASE!!!


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

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



More information about the jboss-user mailing list