Speeding up hibernate startup time using terracotta?

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!

3 Responses to “Speeding up hibernate startup time using terracotta?”

  1. Konstantin Says:

    Just in case you did not see this:
    http://opensource.atlassian.com/projects/hibernate/browse/HHH-1258

    It seems like many have tried but….. it is not that easy

  2. Martijn Dashorst Says:

    From the issue, they didn’t try keeping it running in a separate JVM using terracotta. I am convinced that using terracotta *will* speed up startup time considerably, provided that it works of course.

  3. Bruno Borges Says:

    Martijn, you can serialize the object Configuration and from there, create an instance of SessionFactory.

    Search within Hibernate’s documentation website.

    Regards,
    Bruno

Leave a Reply