Hi all,

I currently have a quesion about using the EAGER/LAZY. I have a class:

  | public class Folder implements Serializable {
  | ...
  |     @OneToMany (mappedBy="folder", cascade=CascadeType.ALL, 
fetch=FetchType.LAZY)
  |     public List<File> getFiles() {
  |             return files;
  |     }
  | ...
  | 
After I load a folder from client, then use getFiles() to get all files, I got 
exception:

  | org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: Folder.files, no session or session was closed
  | 
However, when I changed the LAZY to EAGER, no exception happened. But, I really 
do not want to client to load all files before it calls the getFiles(). How 
should I do? Any help will be appreciate. Thank you in advance. I use EJB RC5 
and JBoss 4.0.4

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to