2013年2月27日
摘要: 在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> 阅读全文
posted @ 2013-02-27 23:39 zcjava 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Configuration cfg = new Configuration.configure();在hibernate3中使用:SessionFactory sessionFactory = cfg.buildSessionFactory();在hibernate4中使用:SessionFactory sessionFactory = cfg.buildSessionFactory(serviceRegistry);而serviceRegistry是通过 ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applyS 阅读全文
posted @ 2013-02-27 23:33 zcjava 阅读(237) 评论(0) 推荐(0) 编辑