日期:2014-05-17  浏览次数:20704 次

hibernate session.save报空指针,,求指教
Java code
public void saveStudent(Student student){
        try {
            transaction = (org.hibernate.Transaction)session.beginTransaction();
            session.save(student);
            transaction.commit();
        } catch (Exception e) {
                transaction.rollback();
        }finally{
            session.close();
        }
        
    }


保存方法如下,求指教,问题不知道出哪了。。

------解决方案--------------------
探讨
Java code


Configuration configuration = new Configuration().configure();
SessionFactory sessionFactory = configuration.buildSessionFactory();
Session session = sessionFactory.openSessio……