You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Jonathan S. Fisher" <ex...@gmail.com> on 2021/08/04 22:23:44 UTC

Dynamically Looking up EntityManager or EntityManagerFactory

This is probably something I should know, but I don't :)

We have 150 users on an app that we're scaling to a couple thousand across
a few servers. We _were_ using EclipseLink's topic based jms cache
coordination, but we're found that it's leaking memory as of late from some
strange interaction between ActiveMq and EclipseLink.

At runtime, we'd have all of the persistence.xml files on the classpath,
but we really wouldn't know all of the persistence units until the app is
launched.

I noticed some information about PUs are available in JMX, so I was curious
if we could create an EntityManager or EntityManagerFactory dynamically
given a unit name. Is it possible to lookup a persistence unit in JNDI
perhaps?

Thank you,
-- 
Jonathan | exabrial@gmail.com
Pessimists, see a jar as half empty. Optimists, in contrast, see it as half
full.
Engineers, of course, understand the glass is twice as big as it needs to
be.