What is JPA:
- JPA is referred to as the Java Persistence API
- Chinese name: Persistence API
- It and learning jdbc or spring-jdbc same level of persistence: dao operation of the database layer that layer
- jpa is a standardized specification of object-relational mapping
- O (Object) R (relationship) M (model map) Hibernate is one specific implementation of the framework
Entity entity:
-
Converting a relational database to an object model (mapping)
-
This used to be the operating performance of the operating entity (the object)
Why JPA, without jdbc - and jdbc jpa compare the advantages and disadvantages?:
JDBC:
Disadvantages:
1. 代码重复性比较高封装数据 比较麻烦
2. 移植数据库比较麻烦
3. 没有缓存---(无法提高的访问速度)
4. 面向sql语句不是面向对象操作
benefit:
如果是sql高手,使用jdbc相当清爽 因为它是直接操作数据库最底层技术
其他的框架技术都是在jdbc上面进行封装
JPA:
benefit:
1. 重复性代码不多 完成crud 只需要调用方法就可搞定
2. 移植数据很方便,到时候只需要配置一些方言就以
3. 提供的世界级缓存支持(一级缓存 二级缓存)
4. 不用写sql ,会自动生成
5. 面向对象操作,操作对象就相当于操作数据库,但是jpa也是支持sql 缺点:
Disadvantages:
1. 特定的场景下,我们不能干预sql的生成,如果你对sql语句要求比较高,不适合使用jpa,
2. 若是数据量太大,比如表里面有上亿条数据,也不适合我们jpa有些性能无法控制
3. JPA 适合一些中小型的项目
SSM(springmvc spring mybatis)