Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extended persistence context

 
Morten Franorge
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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).
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic