一,java框架学习
-
Hibernate概述
Hibernate是一个开放源代码的ORM(对象关系映射)框架,对jdbc进行了轻量级的封装,是的java开发人员可以使用面向对象编程思想操作数据库,简化操作数据库代码量。
Hibernate映射的灵活性很出色,支持很多关系型数据库,从一对一到多对多的各种复杂关系。
可扩展性强。 -
ORM
利用描述对象和数据库表之间映射的元数据,自动把java应用程序中的对象,持久化到关系型数据库表中。通过操作java对象,就可以完成对数据库表的操作。可以把ORM理解成关系型数据和对象的纽带,开发人员只需关注纽带一端的映射的对象即可。
原理图对象关系映射
-
搭建Hibernate环境
导入各种包 -
创建xml格式的文件,在实体类所在的包里创建
-
配置映射关系
-
创建hibernate核心配置文件,引入约束,配置数据库信息