Open KyleAure opened 1 month ago
one should be able to control this through the deploy-on-startup property
@lukasj if I am reading that property correctly
eclipselink.deploy-on-startup=false (lazy)(default)
The persistence unit is not initialized until the first EntityManager is created, or until metadata is required from the EntityManagerFactory.
The lazy configuration which is default initializes the persistence unit upon EntityManager creation. What I'm looking for is to wait until the first usage of an EntityManager method that actually needs a connection.
Is your feature request related to a problem? Please describe.
As a user of EclipseLink and OpenLiberty I notice that my application starts slowly because when an EntityManager is created during application start a Connection is made to the Database to initialize the entity manager (see stack below).
This type of eager initialization does not work well when deploying an application in a container environment. An orchestrator needs to verify applications have started as it scales up. Long wait times for application start could cause an orchestrator to over scale to meet demand which can be handled by a fewer number of pods.
Describe the solution you'd like
I would rather my application start fast, and pay the cost of creating a connection when the connection is actually needed (i.e. during the first persist() operation).
Describe alternatives you've considered
None.
Additional context
This feature would also be useful for systems utilizing checkpoint/restore (CRIU) since an entity manager could be initialized in an pipeline environment without access to the production database. A checkpoint taken, and then restored in an environment where the production database is available.