users@glassfish.java.net

Singleton EJB with persistence context

From: <forums_at_java.net>
Date: Thu, 15 Dec 2011 11:36:55 -0600 (CST)

Hi community,

  I recently wrote an Singleton EJB and I noticed some difficulties to
manage my entities : - The client calls a method which gets an entity from
database and stores it as private attribute (EJB attribute). - Something is
returned to the client, and then it calls another method from the same EJB. -
The singleton didn't forget its attribute, but when trying to force reload
from database, it is said that it is not managed by the persistence context ;
even if calling merge() juste before the reload().   This error occurs when
using injection with @PersistenceContext to the EntityManager. But it doesn't
occur when using the factory (EntityManagerFactory if I remember).   Is it a
bug of Glassfish, or a normal behaviour ? FYI, we are still in 3.0.1.  
Thanks for any kind of explaination.

--
[Message sent by forum member 'laps']
View Post: http://forums.java.net/node/874435