hibernate工作原理

    1、通过 new  Configuration().configure();读取并解析hibernate.cfg.xml。 
  2、由hibernate.cfg.xml中的<mappingresource="com/xx/User.hbm.xml"/>读取解析映射       信息。 
  3、通过config.buildSessionFactory();//得到sessionFactory。 
  4、sessionFactory.openSession();//得到session。 
  5、session.beginTransaction();//开启事务。 
  6、persistent operate; 
  7、session.getTransaction().commit();//提交事务 
  8、关闭session; 
9、关闭sessionFactory;

你可能感兴趣的:(Hibernate,工作原理)