(this question has been posted once before, but I'd really like the authors to answer it, to verify that my assumptions are correct)
I have a question about extended persistence context on a SFSB. If I have a SFSB that's only purpose is to store session(instance) variables. All data retrieval and persistence is done by calling SLSB.
As you can see, the SFSB doesn't use the entityManager, but as the Extended persistence context can only be set on a SFSB (and rightly so) I have to include the entitymanager in the SFSB to get the extended persistence context propogated to the SLSB.
Is this correct? Or is there another way to get the extended persistence context propogated to the slsb, without having do declare a entitymanager in my sfsb that is never used? (The reason I wan't to use an extended Persistence Context is that I don't want the JPA Entities stored as instance variables in the SFSB to be detached).
Your code is semantically correct. However, the true power of extended persistence contexts will be apparent if you use the entity manager directly in the Controller bean instead of using a facade. The entity manager in CustomerServiceBean will not have an extended persistence context. [ March 13, 2007: Message edited by: Reza Rahman ]
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1