An entityManagerFactory for multiple JVMs

Hi,

I would like to save time on the construction of the entityManagerFactory for at least two reasons:

  1. We have 300 overnight batches, and we don’t have the option to add 10 seconds x 300 batches = 50 minutes (we would need to reduce the number of batches, I admit ^^).
  2. We also run a significant number of integration tests, which are increasingly time-consuming.

The idea is therefore to save time on the construction of the entityManagerFactory by serializing it, as shown here:

Serializing the hibernate sessionfactory & deserialize it to improve startup time - Hibernate ORM - Hibernate

But from what I understood, the serialization of the entityManagerFactory is customized to be added to the EntityManagerFactoryRegistry for use via JNDI. So, it compromises my plan a bit.

Is it possible to build an entityManagerFactory in one JVM and utilize it in other JVMs?

Should a distributed cache be used to accomplish this?

Thank you !

Use Quarkus for this purpose. It pre-builds parts of the SessionFactory during application build time and has hence a faster startup.

But can we use Quarkus, or a part of Quarkus, without questioning the entire integration of Hibernate?

Or do I have to migrate everything to Quarkus (with Quarkus dependencies instead of Hibernate) for that?

No idea what kind of integration you are talking about, but there certainly are some limitations with respect to integrators in Quarkus, though it should all work fine in JVM mode.

Regarding serialization, it is not possible due to the transient attributes… I just realized that!