Nicolas Tanghe [http://community.jboss.org/people/ntanghe] created the 
discussion

"@EJB annotation for injection and lazy relations"

To view the discussion, visit: http://community.jboss.org/message/561743#561743

--------------------------------------------------------------
Hi,
 
 I develop a ejb3/jsf application.
 I have lazy relations in my entity beans.
 
 I remark that in my managed bean of my JSF, if I use @EJB annotation to  
inject session bean, I have no problem on lazy on entity beans returned  by 
this session bean. 
 
 Example
 
 JsfManageBean{
 
 @EJB
 Bean sessionBean ...
public void doSomething(){
 
 Department d = sessionBean.findDepartmentBy...
 // relation lazy
 d.getEmployees()
 -> Load of employees -> NO LAZY PROBLEM !
 }
 
 }
 
 Someone can explain me why it works ?
 For me, after the find method, my session is closed !
If I do a lookup to find my session bean (and so no injection @EJB here) -> I 
HAVE THE LAZY PROBLEM !
public void doSomething(){
 
 SessionBean = ... context.lookup("blablabla")
 Department d = sessionBean.findDepartmentBy...
 // relation lazy
 d.getEmployee()
 -> LAZY EXCEPTION
thanks for help !
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/561743#561743]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to