Hello Olivier,
forums_at_java.net wrote:
> Hello Marina,
>
> Thanks a lot for your reply.
>
> The use of "merge()" didn't managed the object when we tried it ;
> we'll retry
> it.
Try it.
>
> In singleton EJB do we really need to close EM ? I mean, there's only one
> instance and always available, so I think we should'nt close the
> EM. Moreover, is PreDestroy called in such case ?
When Singleton is unloaded, PreDestroy is called unless it's a crash
>
> I still don't understand why when using injection we can't manage
> objects.
By default injected EM is transactional, so when transaction ends, the
EM (and the persistence context) is closed by the container. So all
entities that you fetched become detached. If you call multiple methods
in the same transaction, the entities continue to be managed, but then
what would happen if you call them in parallel from different threads?
-marina
>
> Olivier.
>
>
> --
>
> [Message sent by forum member 'laps']
>
> View Post: http://forums.java.net/node/874435
>
>