hibernate4.0+版本和3.0+版本的区别总结
2015-01-26 15:09
302 查看
hibernate4.0+版本和3.0+版本的区别总结
马老师说的好。要穿一手鞋,so,自己总结下hibernate4.1版本中的新特性和hibernate3.3做区别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必须包了
4.Hibernate4.1已经可以自动建表,所以开发时只需要自己开发类然后配置好就OK。不需要考虑怎么建表
相关文章推荐
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate4.0+版本和3.0+版本的区别总结
- hibernate 4.0+版本和3.0+版本的区别总结
- Themida / Winlicense (TM / WL)脱壳总结,Themida脱壳,Winlicense脱壳各个版本区别总结
- Themida / Winlicense (TM / WL)脱壳各个版本区别总结
- 总结系列(opencv中c版本和c++版本区别体验,续...)
- Python3.0和以前版本的区别
- NET2.0/3.0/3.5区别和VS各个版本概览