日期:2014-05-18  浏览次数:20674 次

HIBERNATE编译报错
package   mypack;
import   net.sf.hibernate.*;
import   net.sf.hibernate.cfg.*;

public   class   Test   {

        public   static   void   main(String[]   args)   {

                try   {
                        SessionFactory   sf   =
                                new   Configuration().configure().buildSessionFactory();
                        Session   session   =   sf.openSession();
                        Transaction   tx   =   session.beginTransaction();

                        for   (int   i   =   0;   i   <   200;   i++)   {
                                Customer   customer   =   new   Customer();
                                customer.setUsername( "customer "   +   i);
                                customer.setPassword( "customer ");
                                session.save(customer);
                        }

                        tx.commit();
                        session.close();

                }   catch   (HibernateException   e)   {
                        e.printStackTrace();
                }
        }
}
编译时报错,内容是找不到net.sf.hibernate.*;和net.sf.hibernate.cfg.*;这2个文件
我已经把HIBERNATE目录下的hibernate.jar以及LIB里的所有jar文件复制到项目的LIB目录下了,而且用classpath配置了hibernate.jar路径。但还是找不到以上2个包
求帮忙

------解决方案--------------------
net.sf.hibernate.*;
是hibernate的把包名

------解决方案--------------------
你用的hibernate的那个版本