簡體   English   中英

如何使用 JPA 工具和 EclipseLink 在特定位置生成 SQL 腳本?

[英]How to generate SQL scripts at a specific location with JPA Tools and EclipseLink?

我有一個使用 EclipseLink 2.7.0 設置的項目,我在 Eclipse 中使用 Dali。 我正在嘗試使用上下文菜單生成 SQL 腳本,但我無法將生成的 SQL 腳本設置為 output 在我想要的位置。

persistence.xml文件包含以下內容:

    <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
    <property name="eclipselink.application-location" value="src/main/resources/sql/postgresql/"/>
    <property name="eclipselink.create-ddl-jdbc-file-name" value="051-createDDL.sql"/>
    <property name="eclipselink.drop-ddl-jdbc-file-name" value="050-dropDDL.sql"/>

To have the SQL scripts generated, I right-click on the project, and select JPA Tools > Generate Tables from Entities… then I select Sql-script in the schema generation dialog that opens. 根據本文檔,我希望腳本可以在src/main/resources/sql/postgresql/下使用我指定的名稱提供,但文件會繼續在項目的根目錄下以名稱dropDDL.sqlcreateDDL.sql 就好像我在persistence.xml中指定的內容被忽略了。 我開始懷疑它的內容是否被使用過。

我努力了:

  • eclipselink.ddl-generation定義為所有三個允許的值( create-tables ...),但無濟於事。
  • 使用等效的javax.persistence.schema-generation屬性,也無濟於事。

有沒有我不知道的微妙之處? 或者一些額外的配置? 也許我完全弄錯了,屬性與大理無關?

這是一團糟,但這是您需要的:

在您的示例中,您缺少eclipselink.ddl-generation.output-mode

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM