Hibernate 工作原理

Hibernate 工作原理_第1张图片

 

上图为Hibernate工作原理图,以下为简单整理的步骤

 

private  static Configuration configuration = new Configuration();

 

private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";

 

private static String configFile = CONFIG_FILE_LOCATION;

 

configuration.configure(configFile);

 

private static org.hibernate.SessionFactory sessionFactory;

 

sessionFactory = configuration.buildSessionFactory();

 

Session session = sessionFactory.openSession();

 

Transaction transaction = null;

 

transaction = session.beginTransaction();

 

//数据库操作

 

session.close();

 

 

 

你可能感兴趣的:(数据库,工作,Hibernate,session,String,File)