Hi
I am using the latest version of hibernate
hibernate-distribution-3.3.1 GA
hibernate-annotations-3.4.0 GA
hibernate-tools-3.2.2 Beta 1
I have annotated java entity files that i have mapped in my hibernate.cfg.xml as follows..
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/Test</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.format_sql">true</property>
<mapping class="com.vo.entity.Group"/>
<mapping class="com.vo.entity.GroupAddress"/>
<mapping class="com.vo.entity.GroupUsers"/>
<mapping class="com.vo.entity.User"/>
<!-- Similarly more mapping classes/-->
</session-factory>
</hibernate-configuration>
My project compiles fine, but when i run the project, i get the following error..
Code:
java.lang.NoSuchMethodError: org.hibernate.util.ReflectHelper.classForName(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Class;
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:800)
at com.util.db.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:27)
at com.util.db.UserDB.insertUser(UserDB.java:50)
My util class is something like this..
Code:
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
// config file.
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static Session getSession()
throws HibernateException {
return sessionFactory.openSession();
}
}
Could some one please tell me whats wrong with this and why i am getting the above exception?? Thanks for your help