摘要:
在hibernate中有两个主要的配置文件:hibernate.cfg.xml,xxx.hbm.xml。使用mysql数据库时,hibernate.cfg.xml配置文件如下:<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration> 阅读全文
摘要:
Configuration cfg = new Configuration.configure();在hibernate3中使用:SessionFactory sessionFactory = cfg.buildSessionFactory();在hibernate4中使用:SessionFactory sessionFactory = cfg.buildSessionFactory(serviceRegistry);而serviceRegistry是通过 ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applyS 阅读全文