users@glassfish.java.net

Re: Surprising JPA (Toplink) Behaviour (glassfish v1 UR1)

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Mar 2007 07:39:12 PST

[i]I don't think caching should be turned off by default, but I do think
that it is very weird for JPA's internal cache to not be updated when
you make a change using the entity manager, then load the same entity
again using the same entity manager. I would expect the loaded entity
to be up to date. [/i]

Ok, well that may be the issue. Each subsystem is getting a different
EntityManager from the EntityManagerFactory each time it needs to
interact with the persistent store.

Is that contrary to what should be done? Should I keep an EntityManager
singleton around somewhere and have all code use it?

(Are they thread-safe, BTW?)
[Message sent by forum member 'pohl' (pohl)]

http://forums.java.net/jive/thread.jspa?messageID=208426