hibernate4.0+版本和3.0区别
2013-08-24 23:41
513 查看
hibernate4.0+版本和3.0区别
1.数据库方言设置<property name=”dialect”>org.hibernate.dialect.MySQL5Dialect</property>
在3.3版本中连接MySQL数据库只需要指明MySQLDialect即可。在4.1版本中可以指出MySQL5Dialect
2.buildSessionFactory
4.1版本中buildSessionFactory()已经被buildSessionFactory(ServiceRegistry ServiceRegistry)取代
解决办法:
Configuration cfg = new Configuration(); ServiceRegistry serviceRegistry =new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry(); SessionFactory sf = cfg.configure().buildSessionFactory(serviceRegistry);
3.annotation
org.hibernate.cfg.AnnotationConfiguration;
Deprecated. All functionality has been moved to
Configuration
这个注解读取配置的class已经废弃,现在读取配置不需要特别注明是注解,直接用Configuration cfg = new Configuration();就可以读取注解。
Hibernate4.1版本中推荐使用annotation配置,所以在引进jar包时把requested里面的包全部引进来就已经包含了annotation必须包了
相关文章推荐
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- Hibernate 3.0 以上版本 中get和load方法的区别
- hibernate 4.0+版本和3.0+版本的区别总结
- lucene 3.0与之前版本的一些区别导致的问题
- smarty3.0以上版本清除缓存与之前的区别
- Android各个版本API的区别(1.5-3.0)
- Python3.0和以前版本的区别
- hibernate2.1与hibernate3.0的区别
- Angular ui-grid 2.0 与 3.0 版本区别
- 关于转屏禁止onCreate android 3.0版本之前和之后的区别
- EJB 3.0与Hibernate的区别
- EJB 3.0与Hibernate的区别
- 对于cocos2d-x 3.0版本与之前版本的区别分析-------------cocos2d-x3.0正式版本(7.1)
- iOS AFN 3.0版本前后区别 01
- Python3.0与2.X版本的区别实例分析
- iOS AFN 3.0版本前后区别 02
- hibernate4.0+版本和3.0+版本的区别总结