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 !