@Phon: I found something useful in EJB3 trailblazer 
http://trailblazer.demo.jboss.com/EJB3Trail/services/apptrans/index.html

Im testing the loadlevel solution with a simple application:
There are 4 entities A,B,C,D.
A has OneToMany associations with both B and D (C extends A, i'll use it for 
other tests)

I did the "loadlevel" method:

  | public A getA(long id, List<loadLevel> levelList) {
  |    A a = manager.find(A.class,id);
  |    if(levelList.contains(loadLevel.B)){
  |        a.getListB();
  |    }
  |    if(levelList.contains(loadLevel.D)){
  |        a.getListD();
  |    }
  | return a;
  | }
  | 

loadLevel is an enum and i pass the list of nested object i want to load.

But there is a problem, if i call the method as you see it throws a 
LazyInitializationException, but if i use the "use" the a.getListB() and 
a.getListD like below

  | public A getA(long id, List<loadLevel> levelList) {
  |    A a = manager.find(A.class,id);
  |    if(levelList.contains(loadLevel.B)){
  |        System.out.println(a.getListB());
  |    }
  |    if(levelList.contains(loadLevel.D)){
  |        System.out.println(a.getListD());
  |    }
  | return a;
  | }
  | 

Everythings goes ok, i have the prints on the server side and on the client i 
can reach the collections.
Any suggestion?

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to