Hi, a simple question, how do I make a Lazy loading of a field, a course
@Entity, after having requested through a remote interface of a session bean
(OpenEjb, Tomee 1.7.4, OpenJPA):
APP_A:
@Embedd public class EmbeddCustomClass{...}
@Entity
public class Person{
..
//Default Lazy
private List<EmbeddCustomClass> surnames;
...getters and setters
}
@Remote public interface PersonEntityManagerRemote{ public Person
getPerson(int id);}
@Stateless public class PersonEntityManager implements
PersonEntityManagerRemote{
@PersistenceContext(unitName="person-pu") private EntityManager personPu;
@Override public Person getPerson(int id){return
personPu.find(Person.class, id);}
}
FROM MANAGED BEAN IN SAME APPCONTEXT LAZY WORK FINE
APP_B:
FROM REMOTE CONTEXT, BUT IN SAME RUNNING SERVER:
@Stateless public class RemoteBean{
@EJB private PersonEntityManagerRemote;
pubic void aMethod(){
Person person = PersonEntityManagerRemote.getPerson(12);//THIS WORK
FINE
List<EmbeddCustomClass> surnames = person.getSurnames();//THIS NOT LAZY
LOAD
}
}
Tank!
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/Lazy-loading-from-remote-context-tp4680313.html
Sent from the TomEE Users mailing list archive at Nabble.com.