本帖最后由 lc1cs 于 2013-10-28 09:00:11 编辑

解决方案 »

  1.   

    debug 看下。是不是session 没创建成功。
      

  2.   

    SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    session.save(t);
    session.getTransaction().commit();
      

  3.   

    如果继承HibernateDaoSupport
    直接this.getSession().createQuery();
      

  4.   


    点了debug后F5、F6、F8没反映
    对MyEclipse还不太熟悉
      

  5.   

    继承了HibernateDaoSupport,但我要getCurrentSession获取同一个session
      

  6.   

    加了se.beginTransaction();后可以用了,谢谢
      

  7.   

    继承了hibernatedaosupper,直接this.getSession().createQuery(),也不用session.close();
    意味了里面封装的就是getCurrentSession(),而不是openSession;