spring boot数据库操作汇总

1 关于orm

orm即object relational mapping,对象关系映射,即将数据库中的表映射成对象。

常用的orm有以下:

mybatis

spring jdbc template

hibernate

spring data jpa

如果在spring boot项目中用的是mybatis的话,引入依赖mybatis-spring-boot-starter;

如果在spring boot项目中用的是spring jdbc template的话,引入的依赖spring-boot-starter-jdbc;

如果在spring boot项目中用的是spring data jpa的话,引入的依赖是spring-boot-starter-data-jdbc;

如果在spring boot项目中用的是hibernate的话,引入的依赖是spring-boot-starter-data-jpa。

 

2 关于数据库的驱动

真正的数据库操作需要使用数据库驱动,mysql和postgresql都有直接的驱动。

mysql的驱动依赖是mysql-connector-java;

 

orm的操作是建立在数据库驱动的基础之上的。

 

 

posted @ 2018-12-04 15:32  PhoenixTree(梧桐树)  阅读(261)  评论(0)    收藏  举报