把  Configuration config=new Configuration().configure();
    SessionFactory sessionfactory=config.buildSessionFactory();
   Session session=sessionfactory.openSession();
改成
session=HibernateSessionFactory.currentSession();即可

解决方案 »

  1.   

    你写的配置文件名是不是student.hbm.xml?如果是,当然找不到Student.hbm.xml
    你写的配置文件也是有错的, type="java.lang.Long"应该是type="long"
                              type="java.lang.String"应该是type="string"
      

  2.   

    session.save(stu);
     tran.commit(); 
    改为
     session.save(stu);
     session.flush();        
     tran.commit();        
     closeSession();
      

  3.   

    多半是你的hibernate.cfg.xml文件配置错误
    4. net.sf.hibernate.MappingException: Resource: /Student.hbm.xml not found
    要加上全路径
    比如
    net/myprojcet/pojo/Student.hbm.xml
      

  4.   

    我不懂hibernate,也帮你顶一下
      

  5.   

    student.hbm.xml房在classes目录里面,和class文件放在一起
      

  6.   

    1. 没有找到Student.hbm.xml配置文件,看看你的Hibernate.cfg.xml文件里是否有加载了这个Student.hbm.xml文件,如下:
    <mapping resource="com/project/bean/Student.hbm.xml"/>
    2. 没有找到实体BEAN也就是Student.java可能是你没有把这个文件配置到Classpath中吧;
    3. 找不到实体字段,没办法提交数据库操作语句;
    4. 同第一点。
      

  7.   

    place it at "web-inf/classes"