I’ve just created my first Java EE servlet using Hibernate.
What I don’t know is how to initialize the HibernateUtil class so that
when the first request comes in, it has already loaded the hibernate configuration, and therefore does not have to wait for it to initialize.
Currently it initializes on the first request, and then on all subsequent requests it just reuses the singleton. First request is a bit slow due to this.
You can initialize it in
ServletContextListenerand register it inweb.xmlas