if you know your use-cases lazy-loading is not a big problem.

If you know exactly what to load use a facade with where the business methods 
load what you want. Inside the BM use the EJB QueryLanguage like
from User u left join fetch u.companys as c left join fetch c.country where 
u.login=:login
Problem here is you have to be carefull, if you have more than one left join, 
because you get a the scalar as result (like in this case where you (can) get 
the user x times, also if login is unique)

Another way to do so is to make your faced as Statefully SessionBean (SFSB) 
with a longrunning PersistentContext. In this you get persistent (not detached) 
object you can work with. Also here you should do as much as possible with a 
left join fetch from the associated entities you need in your use-case (one 
join is better than execute a Select each time - if you have products you don't 
want a select for each category).
With a SFSB you control the lifecycle of the bean and the persistentcontext. So 
you have "manually" remove the bean by calling a method annotated with @Remove.

For SFSB and Extended PersistenceContext read the JBoss EJB 3 Trailblazer. If 
you a familiar with JSF it is a good idea to have a deep
look at JBoss Seam (first choice for a good web-application).

Regards

Peter

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

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


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to