Spring配置之JPA(Hibernate)
来源:互联网 发布:cf手游刷枪软件安卓版 编辑:程序博客网 时间:2024/06/06 07:45
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns:persistence="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd ">
<!-- Name属性用于定义持久化单元的名字 (name必选,空值也合法); transaction-type:JTA和RESOURCE_LOCAL
指定事务类型(可选) -->
<!-- JPA的hibernate实现 -->
<persistence-unit name="jpa_hibernate"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="123" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/youbuysdb" />
<property name="hibernate.show_sql" value="true" />
<!-- hibernate.hbm2ddl.auto属性,当值为create时,每次启动应用就会删除旧表结构,重新创建最新的表结构,数据会丢失; -->
<!-- 当值为update时,每次启动应用,如果实体类有变化的话,就会在原来表结构的基础上新建,原始数据不会丢失; -->
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
<persistence version="1.0"
xmlns:persistence="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd ">
<!-- Name属性用于定义持久化单元的名字 (name必选,空值也合法); transaction-type:JTA和RESOURCE_LOCAL
指定事务类型(可选) -->
<!-- JPA的hibernate实现 -->
<persistence-unit name="jpa_hibernate"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="123" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/youbuysdb" />
<property name="hibernate.show_sql" value="true" />
<!-- hibernate.hbm2ddl.auto属性,当值为create时,每次启动应用就会删除旧表结构,重新创建最新的表结构,数据会丢失; -->
<!-- 当值为update时,每次启动应用,如果实体类有变化的话,就会在原来表结构的基础上新建,原始数据不会丢失; -->
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
阅读全文
0 0
- Spring配置之JPA(Hibernate)
- Spring + JPA + Hibernate配置
- spring+hibernate+jpa配置
- spring 配置jdbc/hibernate/jpa
- spring jpa结合hibernate配置
- Spring+JPA+druid+hibernate配置
- spring-data-jpa+spring+hibernate+druid配置
- Spring配置之JPA(Top_link)
- Spring配置之JPA(open_jpa)
- Spring配置之JPA事物
- springmvc+spring+jpa(hibernate)+redis+maven配置
- Spring Boot + Jpa(Hibernate) 架构基本配置
- Spring Boot + Jpa(Hibernate) 架构基本配置
- Spring Boot + Jpa(Hibernate) 架构基本配置
- Spring+hibernate(jpa)+freemarker之数据库连接加密
- hibernate hibernate4之JPA规范配置详解
- SPRING JPA 与 Hibernate JPA
- spring mvc之jpa的配置
- linux安装tomact\jdk\mysql
- Git下载安装使用
- react-navigation-1
- 2016校招真题-懂二进制
- ActiveMq--P2P的使用
- Spring配置之JPA(Hibernate)
- Sublime python 报错 Decode error
- 7017-5-19实训的第五天
- Spring配置之JPA(Top_link)
- python 批量修改文件后缀
- Appium移动自动化测试(二)--安装Android开发环境
- Spring配置之JPA(open_jpa)
- zigbee关联表AssociatedDevList
- Android 文字框,编辑框里的图片点击事件