Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
when i try to execute hibernate program i am getting this problem:
Example code:
package hibernate.examples;
//Hibernate Imports
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class IdIncrementExample {
public static void main(String[] args) {
Session session = null;
try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
org.hibernate.Transaction tx = session.beginTransaction();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Book object into database..");
Book book = new Book();
book.setStrBookName("Hibernate Tutorial");
session.save(book);
System.out.println("Book object persisted to the database.");
tx.commit();
session.flush();
session.close();
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
}
}
}
Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at hibernate.examples.IdIncrementExample.main(IdIncrementExample.java:16)