I'm developing Swing application with JPA 2.0 (EclipseLink 2.0.2)
Since it is Java SE application, I can't use injection and/or JNDI
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?