Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
how to connect to the database using hibernate
hi,
i am a beginner.i have a code with me.now i need to connect this code to the database through hibernate.as far as i know in hibernate we need to create a .cfg file, .xml file, pojo class and one main class.In vaadin do i need to create any such files?can anyone help me out.i need to do this today itself.
meghana vemuri: hi,
i know in hibernate we need to create a .cfg file, .xml file, pojo class and one main class.
If you are using Netbeans, then there is a plugin that will create you the necessary files. Coming vaadin application creates the Application with Table and as a data source use HbnContainer. Detail info http://vaadin.com/wiki/-/wiki/Main/Using%20Hibernate%20with%20Vaadin
i have written the code to connect to the database using hibernate.but i got this error.not able to understand the problem.plz help.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/hibernate/Session
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:738)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:419)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NoClassDefFoundError: org/hibernate/Session
com.zoraly.agridoc.AgridocApplication.<init>(AgridocApplication.java:94)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
com.vaadin.terminal.gwt.server.ApplicationServlet.getNewApplication(ApplicationServlet.java:82)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:706)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:567)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:336)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.ClassNotFoundException: org.hibernate.Session
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
com.zoraly.agridoc.AgridocApplication.<init>(AgridocApplication.java:94)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
com.vaadin.terminal.gwt.server.ApplicationServlet.getNewApplication(ApplicationServlet.java:82)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:706)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:567)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:336)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
Apache Tomcat/6.0.20
meghana vemuri: i have written the code to connect to the database using hibernate.but i got this error.not able to understand the problem.plz help.
java.lang.ClassNotFoundException: org.hibernate.Session
It seems that there is no hibernate library in your CLASSPATH
In order to run hibernate you need to install several libraries; those for hibernate itself, and the libraries that hibernate requires. A bit of Googling gave me the following list: http://www.benmccann.com/dev-blog/minimum-libraries-required-for-hibernate/.
You will normally find these jars in the Hibernate binary distribution, and you need to copy them in your WEB-INF/lib folder (WebContent/WEB-INF/lib if you are using a Vaadin Project under Eclipse).