SimpleEntityManagerProvider reusing the same EntityManager should instead use EntityManagerFactory?

Something that crossed my mind today.
Shouldn't the SimpleEntityManagerProvider create new EntityManagers
for each call to getEntityManager using the EntityManagerFactory?

Hi Ted,

the SimpleEntityManagerProvider is internally only used by a test case. I’m not sure it’s particularly suitable for production purposes, but you never know. I’m pretty sure what it does is fine for this implementation, since it can’t get any simpler than this.

EntityManagerFactory is meant for application managed containers. There is much more involved in this than just creating a new entitymanager and returning it. It needs to be closed at some point as well. The application is responsible for managing this lifecycle.

Cheers,

Allard