Hibernate Hosting
Hibernate is an object relational mapping (ORM) tool for Java. It maps objects to an underling database creating a persistance layer.
Hibernate is supported by all of our Java Web Hosting plans. That said, Hibernate uses cache so an allowance should be made when
calculating resources needed.
To deploy Hibernate on your Java Web Hosting Tomcat:
- Place the hibernate3.jar and all related libraries into the WEB-INF/lib directory of your webapp.
- Create either a hibernate.cfg.xml or a hibernate.properties file and place it into WEB-INF/classes.
- Build a SessionFactory as shown here
- Build a listener:
public class HibernateListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
HibernateUtil.getSessionFactory(); // Just call the static initializer of that class
}
public void contextDestroyed(ServletContextEvent event) {
HibernateUtil.getSessionFactory().close(); // Free all resources
}
}
- Add the listener to your web.xml .
If you are an existing customer needing assistance with Hibernate, please contact
tech support. If you are a prospective customer, please
visit our
Java Web Hosting home page for more information on our hosting plans.
For more details on configuring Hibernate on Tomcat, including a sample hibernate.cfg.xml file, visit the
Tomcat page on Hibernate.org.