hibernate4新特性
来源:互联网 发布:淘宝服装模特修图 编辑:程序博客网 时间:2024/05/16 09:50
1.数据库方言设置
<property name=”dialect”>org.hibernate.dialect.MySQL5Dialect</property>在3.X版本中连接MySQL数据库只需要指明MySQLDialect即可。
在4.X版本中可以指出MySQL5Dialect
2. buildSessionFactory
4.x版本中buildSessionFactory()已经被buildSessionFactory(ServiceRegistry ServiceRegistry)取代
解决办法:
3.annotationConfiguration cfg = new Configuration();ServiceRegistry serviceRegistry =
new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry();SessionFactory sf = cfg.configure().buildSessionFactory(serviceRegistry);
org.hibernate.cfg.AnnotationConfiguration;
Deprecated. All functionality has been moved to Configuration
这个注解读取配置的class已经废弃,现在读取配置不需要特别注明是注解,直接用Configuration cfg = new Configuration();就可以读取注解。
Hibernate4.X版本中推荐使用annotation配置,所以在引进jar包时把requested里面的包全部引进来就已经包含了annotation必须包了
4.Hibernate4.X跟Hibernate3.x以上版本一样, 可以自动创建表;
0 0
- Hibernate4新特性
- hibernate4的新特性
- hibernate4新特性
- Hibernate4 新特性
- hibernate4的一些新特性
- hibernate4 使用及 新特性
- HIbernate4开发要注意的新特性
- hibernate4.1版本中的新特性和hibernate3.3部分区别
- hibernate4中SchemaExport新用法
- Hibernate4新获取Connection方式
- 新特性
- 新特性
- 新特性
- 新特性
- hibernate4.0 中buildSessionFactory()新方式解惑
- Java新特性:接口新特性
- 7.0新特性新1
- hibernate4
- 前淘宝工程师为12306正名:做它比做淘宝难
- 第十三周项目5——2 字符串的复制
- linux 有用命令收集
- 一些国外的MD5破解网站
- How Android Draws Views
- hibernate4新特性
- message.properties 里含有{0}
- c#清除cookie的方式
- 第13周项目2-成绩处理
- gtest快速入门
- 第十三周项目五:字符串操作2.4
- yum和rpm安装zabbix 2.0.9 For centos 6
- 12.0.0.1和localhost的区别
- eclipse下反编译工具javap