[EDIT: Glassfish4.1.1 or Payara payara-4.1.2-174]
I have been profiling a large web app with the NetBeans 8.2 Profiler.
I can see that exactly one instance of each entity is present in memory, at web app startup, before I've loaded anything, and they won't garbage collect. (I've also checked am not loading any entities using JPA callbacks.)
If I take a heap dump and inspect each instance, each one has a GC root with a path (from the instance) like:
this > r : UTY > _b : HMP$F >  : HMP$F > a : HMP > B : TYM > aF(monitor used) : MST
Q: Does ObjectDB for some reason create an instance of each entity (and if so, under what circumstances) ?
I can also see that for Abstract bases of entities it is creating one instance with an instrumented class name. For example, if the abstract entity class is com.example.Common then there is exactly one instance in memory of class objectd.com.example.Common