Time-consuming tasks should not be run on the Event Dispatch Thread. Otherwise the application becomes unresponsive.
Swing components should be accessed on the Event Dispatch Thread only.
So, I use SwingWorker for time-consuming database access.
However, I'm not sure whether objects regarding EntityManager is thread-safe, and there are no "container" to manage them.
1. Can we use EntityManagerFactory object on many threads without explicit synchronize?
2. Can we use EntityManager object (for read-only) on many threads without explicit synchronize?
3. Is it "cheap" to make EntityManager object? (by emf.createEntityManager())
Is it "reasonable" to make EntityManager to invoke only one find operation and close it?
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop