I'm in the middle of creating a conversion utility from one database to another, and I have to reinitialize my Hibernate configuration quite often. When you have a couple of hundred entities that need configuring, starting up Hibernate can take a long time. My initial thought was to serialize the
SessionFactory and deserialize it upon each startup.
I didn't try this yet, but something tells me this won't work. Call it a nagging feeling. However, it should be possible to run the
SessionFactory in a Terracotta cluster and keep that server alive, and connect my conversion utility on startup with the Terracotta cluster. This should make startup times a snap.
Mind you: this is just a thought experiment. If someone has done this before, leave a note!