*
The moose likes EJB and other Java EE Technologies and the fly likes Extended persistence context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Extended persistence context" Watch "Extended persistence context" New topic
Author

Extended persistence context

Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
(this question has been posted once before, but I'd really like the authors to answer it, to verify that my assumptions are correct)

Hi,

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.

Example:



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).


SCJP 1.4, SCBCD 1.3, SCBCD 5.0, SCEA J2EE, SCEA 5.0
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Extended persistence context