1、错误描述
INFO: HHH000206: hibernate.properties not found
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(Ljava/util/LinkedHashSet;Lorg/hibernate/service/classloading/spi/ClassLoaderService;)V
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.<init>(BootstrapServiceRegistryImpl.java:80)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.<init>(BootstrapServiceRegistryImpl.java:57)
at org.hibernate.service.ServiceRegistryBuilder.<init>(ServiceRegistryBuilder.java:76)
at com.you.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:33)
at com.you.hibernate.dao.StudentDao.findAll(StudentDao.java:25)
at com.you.hibernate.dao.StudentDao.main(StudentDao.java:39)
2、错误原因
/**
*
*/
package com.you.hibernate.dao;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.query.Query;
import com.you.hibernate.HibernateSessionFactory;
import com.you.hibernate.model.TStudentInfo;
/**
* @author Administrator
*
*/
public class StudentDao
{
@SuppressWarnings({ "unchecked", "rawtypes" })
public static List<TStudentInfo> findAll()
{
List<TStudentInfo> list = null;
Session session = HibernateSessionFactory.getSession();
Query query = session.createQuery("from TStudentInfo ");
list = query.list();
session.close();
return list;
}
/**
* @param args
*/
public static void main(String[] args)
{
List<TStudentInfo> list = new ArrayList<TStudentInfo>();
list = findAll();
System.out.println(list.size());
}
}
3、解决办法