JPA persistence.xml SQL脚本定义
生活随笔
收集整理的這篇文章主要介紹了
JPA persistence.xml SQL脚本定义
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
您可以在將在運行時執行的JPA持久性上下文定義中定義并鏈接到SQL腳本。 有標準化的屬性來定義腳本,以分別說明如何創建模式,批量加載數據和刪除模式:
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistencehttp://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"><persistence-unit name="prod" transaction-type="JTA"><properties><property name="javax.persistence.schema-generation.database.action"value="drop-and-create"/><property name="javax.persistence.schema-generation.create-script-source"value="create-schema.sql" /><property name="javax.persistence.schema-generation.sql-load-script-source"value="load-data.sql" /><property name="javax.persistence.schema-generation.drop-script-source"value="drop-schema.sql" /></properties></persistence-unit> </persistence>SQL文件應駐留在類路徑中。
這篇帖子從我的新聞通訊004中轉貼了
翻譯自: https://www.javacodegeeks.com/2017/12/jpa-persistence-xml-sql-script-definitions.html
總結
以上是生活随笔為你收集整理的JPA persistence.xml SQL脚本定义的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux的(linux的bind)
- 下一篇: ddos破坏了什么性(ddos破坏了什么