Hello Benjamin,
The specification does not expect synchronization between PersistenceContexts. Infact synchronization of PersistenceContexts would be very dangerous and would eliminate the usage of Optimistic Locking (as the version numbers would always be updated by the Provider).
Managed objects can always be refreshed from the Database using the EnityManager.refresh call. Also, clearing a PersistenceContext will cause the data to be re-loaded on the next query, but all managed objects will become detached. Reading through a transactional EntityManager outside of a transaction will also return the latest data in detached objects.
Hope this is helpful,
--Gordon
-----Original Message-----
From: Benjamin Graf [mailto:Benjamin.Graf_at_gmx.net]
Sent: Thursday, March 30, 2006 12:26 PM
To: persistence_at_glassfish.dev.java.net
Subject: J2SE+EntityManager
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Does anybody know if I can use several EntityManager in J2SE Application at
the same time (in serveral independent Threads)? I have the problem that
changes to the database won't get communicated to all EntityManager
instances.
THX for any help!
Regards, Benjamin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
iD8DBQFELBSR+oSgMM7Y9KsRA9bZAKDUlLxnRosathlf9NLgpo+0u6CM7wCgnHsk
w8rl4OATLA1udQUxdkDIq70=
=AGs/
-----END PGP SIGNATURE-----