On Aug 1, 2007, at 8:08 PM, Marina Vatkina wrote:
Kevin,
Can you please shed more light? What do you call "embedding"
OpenJPA? Is running an ear with a PU in it constitutes the embedding?
If yes, is it not enough to call emf.close() for those emf's that
are created by the container?
How about an emf created by the application via
Persistence.createEMF()?
I use the term "embedding" to describe when a component (that can
potentially run in a stand-alone mode) is included within an
alternate runtime environment. So, in this case Geronimo "embeds"
OpenJPA as the JPA implementation within a Geronimo Java EE 5
application server.
I spent some time trying to allow memory referenced by the PCRegistry
_metas table to be garbage collected automatically (via weak
references/hashmaps). However, I don't think it can be done using the
current implementation of PersistenceCapable objects. Unless that
changes, some explicit trigger is needed in PCRegistry to allow
garbage collection to occur (e.g. a deregister() method). This
trigger can be invoked from within OpenJPA or without. I don't know
OpenJPA well enough to offer internal solutions. So, I provided a
solution that I knew I could make work :-) Worst case, it triggers a
better solution...
--kevan