文档介绍:JPA实体bean配置,jpa增删改api,jpasql增删改
:
jdbc->hibernate(是产品,实现jpa规范)->jpa(是规范,不是产品)。
ps:运用jpa规范的API进行编程,不对Hiberbate,topLink等orm框架构成威胁。
[hibernate-distribution-]
,千万注意目录不能有中文或者空格
:
,再编写配置文件和bean-(面向过程,传统的数据库建模思想)
,在建表(OOP思想)-要求比较高
事务种类:
:支持对同一个数据库的事务操作——大部分应用
:支持对多个数据库的事务操作(银行转账)-两次提交协议
步骤:
第一步:项目结构
:
[html] view plain copy print?
<?xml version="" encoding="UTF-8"?>
<persistence xmlns="http://localhost:3306/xml/ns/persistence"
xmlns:xsi="http://driver /2001/XMLSchema-instance"
xsi:schemaLocation="http://localhost:3306/xml/ns/persistence http://java./xml/ns/persistence/"
version="">
<persistence-unit name="MyJpa" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="" value="" />
<property name="" value="update" /><!--已存在则更新,不存在则创建-->
<property name="" value="" />
<property name="" value="root" />
<property name="" value="123456" />
<property name="" value="jdbc:mysql://localhost:3306/jpadb?useUnicode=true&characterEncoding=UTF-8" />
</properties>
</persistence-unit>
</persisten