hibernate4.1版本中的新特性和hibernate3.3部分区别
2015-05-27 16:55
435 查看
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); //或SessionFactory sf = cfg.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.事务,hibernateTemplete
hibernate4已经完全可以实现事务了 与spring3.1中的hibernatedao,hibernateTemplete等有冲突,所以spring3.1里已经不提供
hibernatedaosupport,hibernateTemplete
相关文章推荐
- 总结Hibernate4.1+版本与Hibernate3.3+版本区别
- Hibernate4.1+版本与Hibernate3.3+版本区别
- Hibernate4与hibernate3有错误的版本号的主要区别所造成的不一致
- MySQL各版本4.1/5.0/5.1/5.5/5.6的主要区别
- spring3.1整合Struts2.3,spring3.1整合hibernate4.1与3.3
- MySQL 4.1/5.0/5.1/5.5/5.6各版本的主要区别
- 【开源】OSharp3.3框架解说系列:重新开源及3.3版本新特性
- hibernate 4.0+版本和3.0+版本的区别总结
- ArcGIS API for JavaScript版本新特性(3.8、3.7、3.3)
- Hibernate 3.0 以上版本 中get和load方法的区别
- hibernate4.0+版本和3.0+版本的区别总结
- JDK各版本之间的特性区别
- hibernate4.0+版本和3.0+版本的区别总结
- MySQL 4.1/5.0/5.1/5.5各版本的主要区别
- Spring4.1新特性——Spring核心部分及其他
- 【SAP BO】BOE 4.1版本新特性
- 4.6版本部分新特性
- hibernate4.0+版本和3.0+版本的区别总结
- Jquery1.x,2.x,3.x之间各个版本的具体区别和特性
- MySQL 4.1/5.0/5.1/5.5/5.6各版本的主要区别整理