When/how should I inject stuffs in a POJO
MyPojo pojo = new MyPojo(); pojo = null;
Suppose that I have a session bean called SessionA and an entity bean called EntityA. SessionA have methods that operate on EntityA.
Also suppose that I have another session bean called SessionB and an entity bean called EntityB. SessionB have methods that operate on EntityB.
Now, if EntityA wants to operate on some EntityB objects (that isn't part of it's attributes) it must go via SessionB.
BUT EntityA can inject a dependency to SessionB via @EJB. I get a null pointer when I try to use the SessionB reference.
So my question remains: Why doesn't @EJB in entity beans (and in POJOs).
This is a very bad design. Your domain model (aka entity model) shouldn't call/use any kind of service (either entitymanager or EJB session or any kind of process layer).